当前位置:网站首页>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
边栏推荐
- Golang — 命令行工具cobra
- Qt学习23 布局管理器(二)
- 信创产业现状、分析与预测
- Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
- [combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
- Go: send the get request and parse the return JSON (go1.16.4)
- Unable to stop it, domestic chips have made another breakthrough, and some links have reached 4nm
- jvm-运行时数据区
- Logback log sorting
- Qt学习21 Qt 中的标准对话框(下)
猜你喜欢

Screenshot of the operation steps of upload labs level 4-level 9

消息订阅与发布
[email protected]纳米粒子"/>金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
![[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update](/img/b8/31609303fd817c48b6fff7c43f31e5.png)
[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update

Mastering the cypress command line options is the basis for truly mastering cypress

Qt学习19 Qt 中的标准对话框(上)

从零开始的基于百度大脑EasyData的多人协同数据标注

掌握Cypress命令行选项,是真正掌握Cypress的基础

GoLand 2021.1.1: configure the multi line display of the tab of the open file

28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
随机推荐
JS general form submission 1-onsubmit
Field problems in MySQL
Students who do not understand the code can also send their own token, which is easy to learn BSC
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
jvm-对象生命周期
Heap structure and heap sort heapify
项目协作的进度如何推进| 社区征文
JVM系列——概述,程序计数器day1-1
logback日志的整理
Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue
ThreadPoolExecutor realizes multi-threaded concurrency and obtains the return value (elegant and concise way)
Flutter dynamic | fair 2.5.0 new version features
Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
FPGA测试方法以Mentor工具为例
RocksDB LRUCache
从零开始的基于百度大脑EasyData的多人协同数据标注
[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
Record 405 questions about bank callback post request