当前位置:网站首页>Basic knowledge of QT original code
Basic knowledge of QT original code
2022-07-02 14:09:00 【Shimmering bagpipe】

untitled1.pro
#-------------------------------------------------
#
# Project created by QtCreator 2022-06-28T09:57:30
#
#-------------------------------------------------
# Qt Modules applied to
QT += core gui
# Compatible with previous Qt edition ( It doesn't usually change )
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
# The name of the generated application
TARGET = untitled1
# Refers to generated makfile type
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Source file
SOURCES += \
main.cpp \
widget.cpp
# The header file
HEADERS += \
widget.h
# UI file
FORMS += \
widget.ui
# Qt Modules applied toQT += core gui# Compatible with previous Qt edition ( It doesn't usually change )greaterThan(QT_MAJOR_VERSION, 4): QT += widgets# The name of the generated applicationTARGET = untitled1# Refers to generated makfile typeTEMPLATE = app
widget.h in
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
// Definition UI The namespace of
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT // macro If signals and slots are used , This class must be added
public:
explicit Widget(QWidget *parent = 0);
~Widget();
private:
Ui::Widget *ui; // use UI In the namespace Widget class , Define a pointer *ui
};
#endif // WIDGET_H
Q_OBJECT // macro If signals and slots are used , This class must be added
Ui::Widget *ui; // use UI In the namespace Widget class , Define a pointer *ui
widget.cpp in
#include "widget.h"
#include "ui_widget.h"
// Constructors
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
}
Widget::~Widget()
{
delete ui;
}
main.cpp
#include "widget.h" // Because the main function uses a window , Need to import header file
#include <QApplication>
int main(int argc, char *argv[])
{
// Application class , Every Qt There is only one application object in the application
QApplication a(argc, argv);
// Window classes create window objects , When the window is created, it will not be displayed by default
Widget w; // top window
w.show(); // Window display
return a.exec(); // The application object runs
}
exec() What is the function of ?
The function is to start a cycle , Execute an event , amount to while(1) and for(;;). Make sure the window doesn't flash
边栏推荐
- Qt原代码基本知识
- 联合搜索:搜索中的所有需求
- 【虹科技术分享】如何测试 DNS 服务器:DNS 性能和响应时间测试
- In 2021, the global TCB adapter revenue was about $93 million, and it is expected to reach $315.5 million in 2028
- mysql ---- Oracle中的rownum转换成MySQL
- Daily practice of C language --- monkeys divide peaches
- BeanUtils -- shallow copy -- example / principle
- MySQL 45 lecture - learning from the actual battle of geek time MySQL 45 Lecture Notes - 04 | easy to understand index (Part 1)
- PyQt5_QScrollArea内容保存成图片
- [to be continued] [UE4 notes] l5ue4 model import
猜你喜欢

selenium,元素操作以及浏览器操作方法

Launcher启动过程

Error: eacces: permission denied, access to "/usr/lib/node_modules"

【虹科技术分享】如何测试 DNS 服务器:DNS 性能和响应时间测试

大家信夫一站式信用平台让信用场景“用起来

Selenium element positioning method
[document tree, setting] font becomes smaller

Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?

抓包工具fiddler学习

Skillfully use SSH to get through the Internet restrictions
随机推荐
QT how to set fixed size
Origin plots thermogravimetric TG and differential thermogravimetric DTG curves
SystemServer进程
Memory management 01 - link script
你知道Oracle的数据文件大小有上限么?
In 2021, the global revenue of structural bolts was about $796.4 million, and it is expected to reach $1097.6 million in 2028
浏览器驱动的下载
Find love for speed in F1 delta time Grand Prix
每天坚持20分钟go的基础二
In 2021, the global TCB adapter revenue was about $93 million, and it is expected to reach $315.5 million in 2028
Route (II)
693. Travel sequencing (map + topology)
Chaos engineering platform chaosblade box new heavy release
Launcher startup process
Runhe hi3516 development board openharmony small system and standard system burning
Qt-制作一个简单的计算器-实现四则运算-将结果以对话框的形式弹出来
[Hongke technology sharing] how to test DNS server: DNS performance and response time test
Launcher启动过程
[USACO05JAN]Watchcow S(欧拉回路)
Qt新项目_MyNotepad++