Recently studying QT,
But the tutorial is of qt3 version ..
The current QT version is qt4. Later, many original qt3 classes are gone. But there is something wrong with it. Which of the following versions does it mean that all old versions are rejected? Later, I checked and found that qt4 still supports qt3. Qt4 provides a large number of new controls, maintains the old controls, and names them as qt3xxx. All of them are placed under the "/QT/include/qt3support" folder, the unmodified controls are placed under the original folder. In the previous blog, we introduced the "select required modules" option when creating a project. If we want to use files in qt3, we need to check the "qt3support modules" option, select this option.
The following is an example of qt3 and qt4.
The source code below qt3 is:
# Include <qapplication. h>
# Include <qpushbutton. h>
# Include <qfont. h>
# Include <qvbox. h>
Int main (INT argc, char ** argv)
{
Qapplication A (argc, argv );
Qvbox box;
Box. Resize (200,120 );
Qpushbutton quit ("quit", & Box );
Quit. setfont (qfont ("Times", 18, qfont: bold ));
Qobject: connect (& quit, signal (clicked (), & A, slot (quit ()));
A. setmainwidget (& Box );
Box. Show ();
Return a.exe C ();
}
In qt4, modify:
# Include <qapplication. h>
# Include <qpushbutton. h>
# Include <qfont. h>
# Include <q3vbox. h>
Int main (INT argc, char ** argv)
{
Qapplication A (argc, argv );
Q3vbox box;
Box. Resize (200,120 );
Qpushbutton quit ("quit", & Box );
Quit. setfont (qfont ("Times", 18, qfont: bold ));
Qobject: connect (& quit, signal (clicked (), & A, slot (quit ()));
A. setmainwidget (& Box );
Box. Show ();
Return a.exe C ();
}