当前位置:网站首页>QT learning 24 layout manager (III)
QT learning 24 layout manager (III)
2022-07-03 13:58:00 【A little black sauce】
Qt Study 24 Layout manager ( 3、 ... and )
reflection
How to design the following graphical user interface ?

Solution
- Absolute positioning Coordinates and size of the assembly
- nesting QBoxLayout
- establish 3*2 Of QGridLayout

The above three methods are more or less problematic , Absolute positioning Coordinates need to be calculated , nesting QBoxyLayout Need to use 4 A layout manager , and 3*2 Of QGridLayout When the window size changes , It will cause the problem of fixed proportion coefficient .
QFormLayout Layout manager
With Forms (Form) Manage interface components in a way
Form layout The tags and components in are Corresponding to each other The relationship between
QFormLayout Usage Summary of
- void addRow(QWidget *label, QWidget *field)
- void addRow(QWidget *label, QLayout *field)
- void addRow(const QString& labelText, QWidget *field)
- void addRow(const QString& labelText, QLayout *field)
Form layout Support nested , Other layout managers can be managed as sub layouts
Programming experiment
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
class Widget : public QWidget
{
Q_OBJECT
public:
Widget(QWidget *parent = 0);
~Widget();
};
#endif // WIDGET_H
#include "Widget.h"
#include <QLineEdit>
#include <QFormLayout>
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
QLineEdit *nameEdit = new QLineEdit();
QLineEdit *mailEdit = new QLineEdit();
QLineEdit *addrEdit = new QLineEdit();
QFormLayout *layout = new QFormLayout();
layout->addRow("Name:", nameEdit);
layout->addRow("Email:", mailEdit);
layout->addRow("Address:", addrEdit);
// layout->setRowWrapPolicy(QFormLayout::WrapAllRows);
layout->setRowWrapPolicy(QFormLayout::WrapLongRows); // Adaptive labels and edit boxes
layout->setSpacing(10);
setLayout(layout);
setWindowTitle("FTP");
}
Widget::~Widget()
{
}
#include "Widget.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}
QFormLayout Style function of
- void setRowWrapPolicy(RowWrapPolicy policy)
- void setLabelAlignment(Qt::Alignment alignment)
Nesting of layout managers

Summary
- QFormLayout With Forms Manage interface components in a way
- QFormLayout Of style Set up concise clear
- QFormLayout Support the nesting of layout managers
- QFormLayout Embedded products The most commonly used layout
边栏推荐
- Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
- Function calling convention
- Go language unit test 3: go language uses gocovey library to do unit test
- Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
- Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
- Sequence table (implemented in C language)
- Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
- 金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
- windos 创建cordova 提示 因为在此系统上禁止运行脚本
- IBEM 数学公式检测数据集
猜你喜欢
[email "/>Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email

又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了
[email protected] (FE) | glycyrrhetinic acid modified metal organ"/>Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
![[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered](/img/06/b71b505c7072d540955fda6da1dc1b.jpg)
[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered

Qt学习21 Qt 中的标准对话框(下)

Unity embeddedbrowser browser plug-in event communication
![Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:](/img/2f/33504391a661ecb63d42d75acf3a37.png)
Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:

Flutter dynamic | fair 2.5.0 new version features

PhpMyAdmin stage file contains analysis traceability

Qt学习18 登录对话框实例分析
随机推荐
Thrift threadmanager and three monitors
FPGA测试方法以Mentor工具为例
Richview trvstyle liststyle list style (bullet number)
Qt学习22 布局管理器(一)
金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
Universal dividend source code, supports the dividend of any B on the BSC
GoLand 2021.2 configure go (go1.17.6)
[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心
SQL Injection (GET/Select)
Go 1.16.4: manage third-party libraries with Mod
太阳底下无新事,元宇宙能否更上层楼?
windos 创建cordova 提示 因为在此系统上禁止运行脚本
Leetcode-1175. Prime Arrangements
Qt学习25 布局管理器(四)
[技術發展-24]:現有物聯網通信技術特點
Sequence table (implemented in C language)
Golang — template
ThreadPoolExecutor realizes multi-threaded concurrency and obtains the return value (elegant and concise way)
Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
JS new challenges