- 3.1 Split window QSplitter class
- QSplitter *splitterMain = new QSplitter(Qt::Horizontal,0);
- QTextEdit *textLeft = new QTextEdit(QObject::tr("Left Widget"),splitterMain);
- textLeft->setAlignment(Qt::AlignCenter);
- Set the alignment of text in TextEdit:
- Qt::AlignLeft
- Qt::AlignRight
- Qt::AlignCenter
- Qt::AlignUp
- Qt::AlignBottom
- splitterMain-> setOpaqueResize (false):
- Set whether to update the display in real time when the dividing line is dragged
- true: real-time update display
- false:
- splitterMain->setStretchFactor(1,1)
- Set the scalable control, the first parameter specifies the serial number of the control, from 0, 1, 2..., the second parameter is greater than 0, which means it is scalable
- Set the scalable control, the first parameter specifies the serial number of the control, from 0, 1, 2..., the second parameter is greater than 0, which means it is scalable
- 3.2 Dock window QDockWidget class
- Create a docked window of a QDockWidget object
- Set the docking window properties setFeatures() and setAllowedAreas()
- Create a new control to be inserted into the docked form, commonly used are QListWidget and QTextEdit
- Insert the control into the docked form and call the setWidget() method of QDockWidget
- Use the addDockWidget() method to add this docking window to MainWindow
- 3.3 Stack window QStackedWidget class
- 3.4 Basic layout (QLayout)
- Commonly used methods in layout are addWidget() and addLayout()