1. Split the window qsplitter
(1) qsplitter constructor:
Qsplitter * splittermain = new qsplitter (QT: horizontal, 0 );
The first parameter is set to horizontal or vertical using QT: horizontal and QT: vertical. The second setting 0 indicates the main window without a parent window. When 0 is replaced with splittermain, it indicates that the main window is used, and the Child splitter is added to splittermain.
Common statements
① Set whether to update in real time when dragging:
Splitterright-> setopaqueresize (false );
False indicates that it is not updated in real time (only one gray line is displayed when you drag it, and the split lines are displayed after you drag it in place and release the mouse ). The default value is true (Real-time update ).
② Specify the font display:
Qfont font ("font type", size );
A. setfont (font );
③ Text alignment:
Example: Object-> setalignment (QT: aligncenter)
④ Splittermain-> setstrechfactor (): used to set a Scalable Control. The first parameter specifies the control serial number, and the second parameter is greater than 0, indicating that the control is a Scalable Control.
2. Call window qdockwidget class:
(1) create a docking form for the qdockwidget object:
Qdockwidget * dock = new qdockwidget (TR ("dockwindow"), this );
(2) set the features of the dock form:
Object-> setfeatures (qdockwidget: dockwidgetmovable); Movable
Dockwidgetclosables can be disabled
Dockwidgetfloatable floatable
Alldockwidgetfeatures has all the features of the dock form
Nodockwidgetfeatures cannot be moved, closed, or floating
(3) setallowedareas:
Object-> setallowedareas (QT: dockwidgetareas areas );
Qt: leftdockwidgetarea can be docked on the left side of the window
Qt: rightdockwidgetarea can be docked at the right of the window
Qt: topdockwidgetarea can be docked at the top of the window.
Qt: bottomdockwidgetarea can be docked at the bottom of the window
Qt: alldockwidgetarea can be docked in any direction of the window
Qt: nodockwidgetarea can only be docked at the Insert Location
Qt5 layout management (1)