当前位置:网站首页>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
边栏推荐
- 树的深入和广度优先遍历(不考虑二叉树)
- Failure of vector insertion element iterator in STL
- UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
- Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
- 从零开始的基于百度大脑EasyData的多人协同数据标注
- PhpMyAdmin stage file contains analysis traceability
- jvm-运行时数据区
- Function calling convention
- selenium 浏览器(1)
- Depth and breadth first traversal of tree (regardless of binary tree)
猜你喜欢
从零开始的基于百度大脑EasyData的多人协同数据标注
Use and design of Muduo buffer class
Installation impression notes
[email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂"/>
金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
[email protected])|制备路线"/>
叶酸修饰的金属-有机骨架(ZIF-8)载黄芩苷|金属有机骨架复合磁性材料([email protected])|制备路线
GoLand 2021.2 configure go (go1.17.6)
RocksDB LRUCache
UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
Richview trvstyle liststyle list style (bullet number)
SQL Injection (GET/Select)
随机推荐
[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心
信创产业现状、分析与预测
全局事件总线
交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳
怎样删除对象的某个属性或⽅法
[技术发展-24]:现有物联网通信技术特点
[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
Depth and breadth first traversal of tree (regardless of binary tree)
Error running 'application' in idea running: the solution of command line is too long
MySQL 数据处理值增删改
使用vscode查看Hex或UTF-8编码
Go language unit test 3: go language uses gocovey library to do unit test
JVM family - overview, program counter day1-1
Static linked list (subscript of array instead of pointer)
selenium 浏览器(1)
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
Richview trvstyle liststyle list style (bullet number)
Stack application (balancer)
Disruptor -- a high concurrency and high performance queue framework for processing tens of millions of levels
There is nothing new under the sun. Can the meta universe go higher?