Qwidget W
Qlineedit edit;
Edit.show (); If this is not the case, the edit box will be displayed in the upper-left corner of the parent window
Edit.setparent (&W); With W as the parent window and displayed on top
W.show ();
Qconnect (&button,signal (clicked ()), &w,slot (Close ())); Click the button to close the W window. W is the object, &w is the window
The exclusive use of Qlineedit
Qlineedit edit;
Edit.settext ("display text"); Display text above the edit box
Edit.setechomode (qlineedit::p assword); The password entered automatically turns into a circular pattern
Edit.setechomode (qlineedit::p asswordechoonedit); The password entered becomes a circular pattern after losing focus
Account matching mode (enter a number to display the entire account)
Qcompleter Completer (stringlist () << "598265430" << "1710514175");
Completer.setfiltermode (Qt::matchcontains); As long as the content that is contained can match
Edit.setcompleter (&completer); Match all the strings above the Completer on the edit box, only with the first character as the Datum
Set Control position
Edit.setgeometry (30,30,100,30); X, y, long, tall, not very good.
Qhboxlayout layout; QH for transverse qv for portrait
Layout.addstretch (1); Add Spring fixed position
Layout.addwidget (&button);
Layout.addspacing (+); 50 pixels separated from the middle
Layout.addwidget (&edit);
Layout.addstretch (1); Add Spring fixed position
W.setlayout (&layout);
Layout can help you fix the parent-child relationship, you can omit the above setparent.
Qgridlayout class (Lattice Class)
Qgridlayout layout;
Layout.setcolumnstretch (3,1); The spring of the column
Layout.setrowstretch (3,1); The spring of the line
Layout.setcolumnstretch (0,1);
Layout.setrowumnstretch (0,1);
Layout.addwidget (&button,1,1);
Layout.addwidget (&edit,1,2);
Layout.addwidget (New Qpushbutton ("a"), 2, 1);
Layout.addwidget (New Qpushbutton ("B"), 2,2);
Layout.addwidget (New Qpushbutton ("Merger"), 3,1,1,2); The following two parameters are combined with 1 rows and 2 columns
QT5 Basic Knowledge