当前位置:网站首页>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
边栏推荐
- selenium 浏览器(1)
- mysql中的字段问题
- JS continues to explore...
- GoLand 2021.1.1: configure the multi line display of the tab of the open file
- 信创产业现状、分析与预测
- Another industry has been broken by Chinese chips. No wonder the leading analog chip companies in the United States have cut prices and sold off
- jvm-对象生命周期
- [technology development-24]: characteristics of existing IOT communication technology
- Golang — 命令行工具cobra
- Leetcode-1175. Prime Arrangements
猜你喜欢
Multi person collaborative data annotation based on Baidu brain easydata from scratch
全面发展数字经济主航道 和数集团积极推动UTONMOS数藏市场
How to use lxml to judge whether the website announcement is updated
Qt学习22 布局管理器(一)
Use vscode to view hex or UTF-8 codes
Implementation of Muduo asynchronous logging
Error running 'application' in idea running: the solution of command line is too long
【BW16 应用篇】安信可BW16模组与开发板更新固件烧录说明
Spring cup eight school league
Halcon combined with C # to detect surface defects -- Halcon routine autobahn
随机推荐
Comprehensive case of MySQL data addition, deletion, modification and query
[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update
叶酸修饰的金属-有机骨架(ZIF-8)载黄芩苷|金属有机骨架复合磁性材料([email protected])|制备路线
1px problem of mobile terminal
Conversion function and explicit
【556. 下一个更大元素 III】
Qt学习25 布局管理器(四)
JVM family - overview, program counter day1-1
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
ThreadPoolExecutor realizes multi-threaded concurrency and obtains the return value (elegant and concise way)
How to use lxml to judge whether the website announcement is updated
Halcon combined with C # to detect surface defects -- Halcon routine autobahn
3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)
金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
Complete DNN deep neural network CNN training with tensorflow to complete image recognition cases
项目协作的进度如何推进| 社区征文
Which securities company has the lowest Commission for opening an account online? I want to open an account. Is it safe for the online account manager to open an account
Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:
RichView TRVStyle ListStyle 列表样式(项目符号编号)
Heap structure and heap sort heapify