2015/08/07///////////////
by xbw//////////////////////
Environmental Qt 5.3.1////////////
Learning the video is QT4, how much a bit of a problem, I used the QT5, in this empty file project found the problem,
In the main.cpp header file does not have the file or the directory, after the net search, discovered QT upgrade 5 GUI to belong to the widget, so, in 5 we need to add such a sentence qt+ +core in Pro GUI widgets just fine.
#include <QApplication> #include <QLabel> #include <QHBoxLayout> #include <qvboxlayout># Include <QPushButton> #include <QtGui> #include <qtcore>int main (int Argc,char *argv[]) {qapplication App (ARGC,ARGV); Qwidget *window1=new Qwidget; Window1->setwindowtitle ("My App"); Qgridlayout *layout=new qgridlayout; Qlabel *label1 =new Qlabel ("Name:"); Layout->addwidget (label1,0,0); Window1->show (); Create a window qwidget *window=new qwidget; Window name Window->setwindowtitle ("My App"); Create three buttons Qpushbutton *button1=new Qpushbutton ("one"); Qpushbutton *button2=new Qpushbutton ("one"); Qpushbutton *button3=new Qpushbutton ("one"); A horizontally arranged pointer qhboxlayout *hlayout =new qhboxlayout; The horizontally arranged pointer points to three buttons Hlayout->addwidget (button1); Hlayout->addwidget (button2); Hlayout->addwidget (Button3); Window->setlayout (hlayout); Window->show (); Create a display text window Qlabel *label=new qlabel ("
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
QT Learning Note (ii)--QT blank Document project