Use a block to control the number box on the qt Interface

Source: Internet
Author: User

# Include <qapplication>
# Include "Yu. H"
# Include "qwidget. H"
# Include "qmenubar. H"
# Include <qmenu>
# Include "qaction. H"
# Include "qlcdnumber. H"
# Include "qslider. H"
# Include "qobject. H"

Int main (INT argc, char * argv [])
{
Qapplication A (argc, argv );
Qwidget W; // form a canvas
 
Qlcdnumber num (2, & W); // number display box

Num. Resize (100,300); // place

Qslider slider (& W); // Block
Slider. setvalue (23); // set the range
Slider. setrange (0,200); // set the value
Qobject: connect (& slider, signal (valuechanged (INT), & num, slot (Display (INT); // connects the block and number display boxes.

W. Show ();
Return a.exe C ();
}
// Each menu can be used as a container and then added as a sub-menu. Compared with MFC, the method for generating sub-menus using QT is much easier.

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.