Qvboxlayout *lay = new Qvboxlayout (this); Create a vertical box
Lebel article
Lay->addwidget (label = new Qlabel ("<a href=www.baidu.com>baidu</a>")); Set up a link to Baidu
Label->setpixmap (Qpixmap ("1.png")); Show bitmap
Connect (label,&qlabel::linkactivated,[] (QString str) {
Qdebug () <<str;
});
Button class
Lay->addwidget (Button = new Qpushbutton ("button"));
Button->setstylesheet ("Qpushbutton {font:bold 16px; color:red} ");
HTML formatting font Red 16 pixels bold is blackbody
Lay->addwidget (radio = new Qradiobutton ("RadioButton"));
Radio->setstylesheet ("Qradiobutton {font:bold 16px; color:red} ");
Lay->addwidget (New Qcheckbox ("Check"));
ComboBox Chapter
Lay->addwidget (Combox = new Qcombobox ());
Combox->additem ("1"); Add an option
Combox->additem ("2"); Two + options added
Combox->seteditable (true); Set options to edit
Combox->setcompleter (New Qcompleter (Combox->model ())); Set default match
Lay->addwidget (edit = new Qtextedit);
Edit->settext ("<table border = 1><tr><th>head1</th><th>head2</th></tr > "
"<tr><td>value1</td><td>value2</td></tr>"
"</table><br>"
"</img>");
Edit->setverticalscrollbarpolicy (qt::scrollbarasneeded); Set the value scroll bar, as needed
IMG src= Image address abbreviation
HTML-formatted table border for boundary <tr> Yes row <th> is header <td> is cell
<table> the beginning of the table <br> line break equals "\ n"
Slider and Spinbox Articles
Qslider *slider;
Lay->addwidget (slider = new Qslider (qt::horizontal));
Slider->setmaximum (100);
Slider->setminimum (0);
Qspinbox *spinbox;
Lay->addwidget (Spinbox = new Qspinbox);
Spinbox->setmaximum (100);
Spinbox->setminimum (0);
Connect (slider,signal (valuechanged (int)), Spinbox,slot (setValue (int)));
Connecting Spinbox and Sliders
Connect (spinbox,signal (valuechanged (int)), Slider,slot (setValue (int)));
One value change causes the other value to be set
LCD article
Qlcdnumber *LCD;
Lay->addwidget (LCD = new Qlcdnumber (10)); Set size
Lcd->display ("12345:6"); Show numbers or strings
Lcd->setsegmentstyle (Qlcdnumber::flat); Set paragraph style
QT 5 Basics 2 (Control article)