当前位置:网站首页>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
边栏推荐
- P1042 [noip2003 popularization group] Table Tennis
- Using computed in uni app solves the abnormal display of data () value in tab switching
- docker mysql
- Unity small map production [2]
- 线性dp求解 最长子序列 —— 小题三则
- Skillfully use SSH to get through the Internet restrictions
- 错误:EACCES:权限被拒绝,访问“/usr/lib/node_modules”
- Android kotlin broadcast technology point
- Drawing Nyquist diagram with MATLAB
- Sum of the first n terms of Fibonacci (fast power of matrix)
猜你喜欢
In 2021, the global revenue of structural bolts was about $796.4 million, and it is expected to reach $1097.6 million in 2028
MySQL 45 lecture - learning the actual battle of MySQL in Geek time 45 Lecture Notes - 05 | easy to understand index (Part 2)
Sum of the first n terms of Fibonacci (fast power of matrix)
Codeforces Round #803 (Div. 2)(A~D)
C crystal report printing
全屋Wi-Fi:一个谁也解决不好的痛点?
[document tree, setting] font becomes smaller
万物生长大会在杭召开,当贝入选2022中国未来独角兽TOP100榜单
Use bloc to build a page instance of shutter
Code implementation MNLM
随机推荐
你的 Sleep 服务会梦到服务网格外的 bookinfo 吗
关于Flink框架窗口(window)函数最全解析
Qt原代码基本知识
Use bloc to build a page instance of shutter
Daily practice of C language --- monkeys divide peaches
路由(二)
Analysis of CPU surge in production environment service
Qt入门-制作一个简易的计算器
Characteristics of selenium
SystemServer进程
C crystal report printing
Android kotlin fragment technology point
Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?
693. 行程排序(map + 拓扑)
Origin plots thermogravimetric TG and differential thermogravimetric DTG curves
Just 1000 fans, record it
Do you know that there is an upper limit on the size of Oracle data files?
P1347 排序(拓扑 + spfa判断环 or 拓扑[内判断环])
Methods of software testing
P1347 sorting (topology + SPFA judgment ring or topology [inner judgment ring])