Qt4 compatibility with qt3 is not found in qt4

Source: Internet
Author: User

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 ();

}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.