One ,
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11
DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp \ mainwidget.cpp
HEADERS += \ mainwidget.h qnx: target.path = /tmp/$${TARGET}/bin else:
unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path):
INSTALLS += target
introduce :
1.
QT += core gui
Add module , Different modules can be added by themselves
Qt Widgets It was separated from the fifth edition
2.
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greater than 4 Version above , contain widget modular
3. stay debug Can't run in the file , The following figure appears
resolvent : Go to the software installation bin Copy under folder bin file
Configuring system variables in a computer
You can open it again in the folder state exe It's a document
4.
CONFIG += c++11
use C++11 To compile
5.
DEFINES += QT_DEPRECATED_WARNINGS
Define compilation options .QT_DEPRECATED_WARNINGS When Qt Some features of are marked as obsolete , The compiler will issue a warning .
6.
SOURCES += \ main.cpp \ widget.cpp
sources Source file under file
7.
HEADERS += \ widget.h
Headers Source file under file
8.
TARGET = "guoguo"
generate exe File name of
9.
qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path =
/opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
Add library files dynamically
Two ,
#ifndef WIDGET_H #define WIDGET_H #include <QWidget> class Widget : public
QWidget { Q_OBJECT public: Widget(QWidget *parent = nullptr); ~Widget(); };
#endif // WIDGET_H
* #ifndef WIDGET_H #define WIDGET_H
Header file
2.
#endif // WIDGET_H //#ifndef
Prevent renaming
3.
#include <QWidget>
Contains a window header class
4.
class Widget : public QWidget { }
Window class inheritance QWiget class
5.
Q_OBJECT
Mechanisms to allow signals and slots in classes
6.
public: Widget(QWidget *parent = nullptr); ~Widget();
Constructors and Destructors
Technology
Daily Recommendation