What is Qt(according to baidu Encyclopedia) :
Qt is a cross-platform C++ graphical user interface application development framework developed by Qt Company in 1991. It can be used to develop both GUI programs and non-GUI programs, such as console tools and servers. It is also the basis of the popular Linux desktop environment KDE. Qt is an object-oriented framework that uses special code generation extensions (called Meta Object Compilers (MOC)) as well as macros that make it easy to extend and allow true component programming.
In 2008, Qt Company Technology was acquired by Nokia, and Qt became a programming language tool owned by Nokia. In 2012, Qt was acquired by Digia.
In April 2014, the cross-platform integrated development environment Qt Creator 3.1.0 was officially released, which fully supported IOS. Plug-ins such as WinRT and Beautifier were added, GDB debugging support without Python interface was abandoned, and CLang-based C/C++ code module was integrated. And the Android support has been adjusted to achieve full support for iOS, Android, WP, it provides application developers with all the functionality needed to build state-of-the-art graphical user interfaces. Basically, it’s the same kind of thing as MFC, OWL, VCL, ATL on the Windows platform.
Qt also has bindings with scripting languages such as Python, Ruby, and Perl, which means you can develop Qt-based programs using scripting languages. That’s the way the open source community works. Good things get spawned, used everywhere, and grow bigger and bigger.
Qt supports many operating systems, such as general operating systems Windows, Linux, Unix, smartphone systems Android, iOS, WinPhone, embedded systems QNX, VxWorks and so on.
New project: Open QtCreator
File – New Project – Select Qt Widgets Application- Choose
Select the compile tool. Qmake comes with Qt, and cmake is now officially recommended
The project generates the required files
Cmakelists. TXT: after installing Qt, you need to configure the Qt environment variables
Main. CPP: this is the main class of the whole project, which is equivalent to main. Each project has a unique QApplication, which is equivalent to main. It’s for the object tree mechanism. The show then shows that a.ec is continuing to listen for other events, which are then assigned to each control or window.
H: This is the header file of the window class, inheriting MainWindow, referencing the generated UI file of MainWindow, and interacting with UI controls within CPP.
The MainWindow. CPP: MainWindow constructor,
The parent argument specifies the parent of the Dialog. A value of 0 means the Dialog has no parent object. No parent object is a window, with a parent object is a control
Mainwindow. UI: Visual window design, but also directly in the code, the UI file and CPP compile into one fileHelloworld: Drag a button into the UI file window, define the signal slot, and print Hello World!Right button, click to go to slot:
Lower left corner start project – Saveall: Click the button and see printed Hello World!