A tutorial on configuring QT environment under VS2013 I will not write a lot on the internet, then I would like to give a very simple introduction to the demo example.
Main.cpp
#include "qttest.h"
#include <QtWidgets/QApplication>
#include <qtwidgets/ qpushbutton>
int main (int argc, char* argv[])//main is the portal of the main program, used to initialize some of the program control to the QT library
{
qapplication app (argc, argv); It is necessary to create a Qapplication object before any QT window System parts are used.
Qpushbutton button ("Hello Qt", NULL); Create a button//app.setmainwidget (&button) that displays "Hello Qt"
;//Set the main window part of the Application as button
button.resize (MB); Call the button's resize function to reset the button size to 200*200
button.show (); Call the Display function
return app.exec ();//Here main controls the program to Qt, and when the application exits QT returns
//in EXEC (). QT accepts and processes user and system events and passes them to the appropriate widget.
}
Qtest.h
#ifndef qttest_h
#define QTTEST_H
#include <QtWidgets/QMainWindow>
#include "ui_ Qttest.h "
class Qttest:public Qmainwindow
{
q_object public
:
qttest (Qwidget *parent = 0);
~qttest ();
Private:
ui::qttestclass Ui;
};
#endif//Qttest_h
Qtest.cpp
#include "qttest.h"
qttest::qttest (Qwidget *parent)
: Qmainwindow (parent)
{
UI.SETUPUI (this);
}
Qttest::~qttest ()
{
}