当前位置:网站首页>layout manager
layout manager
2022-08-04 08:15:00 【Bitton】
The so-called GUI interface, in the final analysis, is the superposition of a bunch of components.We create a window, put buttons on it, put icons on it, and it becomes an interface.The location of the components is especially important when it comes to placement.We have to specify where to put the component so that the window can be rendered the way we want.This involves the mechanism of component positioning.
Qt provides two component positioning mechanisms: absolute positioning and layout positioning
Absolute positioning is one of the most primitive positioning methods: give the coordinates and length and width values of this component.
This way, Qt knows where to put the component and how to size it.But one problem with this is that if the user changes the size of the window, such as by clicking the maximize button or dragging the edge of the window with the mouse, absolutely positioned components will not respond.This is also natural, since you're not telling Qt whether and how the component should update itself when the window changes.Or, there is an easier way: prohibit the user from resizing the window.But this is not always the long-term solution.
Layout positioning: As long as components are placed in a layout, the layout is managed by a dedicated layout manager.When resizing or positioning is required, Qt uses the corresponding layout manager to adjust.
Layout positioning perfectly solves the defects of using absolute positioning.
The following three layouts provided by Qt are the most commonly used:
QHBoxLayout: Layout from left to right in the horizontal direction;
QVBoxLayout:Layout from top to bottom in the vertical direction;
QGridLayout: Layout in a grid, similar to HTML table.
1. System-provided layout controls
These 4 are the layouts provided by the systemControls, but not very flexible to use.
2. Use widgets for layout
The second layout method is to use the widget in the control to do the layout, in the Containers
The controls in the widget can perform horizontal, vertical, grid layout and other operations, which are more flexible.
While re-layout, we need to flexibly use the characteristics of spring to make our layout more beautiful. The following is a login window. Using widgets, we can build the following login interface:
边栏推荐
- 使用requests post请求爬取申万一级行业指数行情
- [Paper Notes] - Low Illumination Image Enhancement - Supervised - RetinexNet - 2018-BMVC
- MySQL 8.0.29 详细安装(windows zip版)
- 解决:Hbuilder工具点击发行打包,一直报尚未完成社区身份验证,请点击链接xxxxx,项目xxx发布H5失败的错误。
- 【JS 逆向百例】某网站加速乐 Cookie 混淆逆向详解
- 新特性解读 | MySQL 8.0 在线调整 REDO
- 【论文笔记】Delving into the Estimation Shift of Batch Normalization in a Network
- js-第一个出现两次的字母
- 在GBase 8c数据库后台,使用什么样的命令来对gtm、dn节点进行主备切换的操作?
- 线程安全问题
猜你喜欢
随机推荐
经典二分法查找的进阶题目——LeetCode33 搜索旋转排序数组
【UE虚幻引擎】UE5实现动态导航样条线绘制
技术实现 | 图像检索及其在淘宝的应用
解决:Hbuilder工具点击发行打包,一直报尚未完成社区身份验证,请点击链接xxxxx,项目xxx发布H5失败的错误。
占位,稍后补上
[Computer recording screen] How to use bandicam to record the game setting graphic tutorial
Linux之Redis 缓存雪崩,击穿,穿透
一天学会JDBC04:ResultSet的用法
经典递归回溯问题之——解数独(LeetCode 37)
Lightweight Backbone VGNetG Achieves "No Choice, All" Lightweight Backbone Network
关于常用状态码4XX提示错误
【JS 逆向百例】某网站加速乐 Cookie 混淆逆向详解
【虚幻引擎UE】UE5基于Gltf加载插件实现gltf格式骨骼动画在线/本地导入和切换
经典动态规划问题的递归实现方法——LeetCode39 组合总和
智汇华云 | 华云软件定义网络 DCI介绍
金仓数据库 KDTS 迁移工具使用指南 (4. BS 版使用说明)
Typora_Markdown_图片标题(题注)
金仓数据库 KDTS 迁移工具使用指南 (6. 注意事项)
华为设备配置VRRP与NQA联动监视上行链路
尚医通【预约挂号系统】总结