当前位置:网站首页>QT learning 07 coordinate system in QT
QT learning 07 coordinate system in QT
2022-06-30 00:00:00 【A little black sauce】
Qt Study 07 Qt The coordinate system in
Coordinate system
GUI Each operating system has a specific Coordinate system
Graphical interface program Locate windows and components in the coordinate system
Location type
- Positioning of the top-level widget
- Positioning of internal parts of the window
- The size of the widget
Qt Use A unified coordinate system To locate a widget Location and size
Qt Parts supply Member functions Positioning in a coordinate system
QWidget class Provide The required for the widget Coordinate system member functions

remarks :
The upper left corner of the screen is black (0, 0) The window is positioned in the display 0 coordinate ;
The upper left corner of the window is green (0, 0) It is located in the customer area 0 coordinate .
Coordinate system related member functions
- QWidget Coordinate system member functions in class

remarks :
- QWidget Of x(),y() Is the position of the entire window in the display ,width(),height() Is the width and height of the client area in the window
- geometry() Of x(),y(),width(),height() Is the location and size of the client area inside the window , Does not include title blocks and borders ,geometry() Of width(),height() and QWidget Medium width(),height() It's the same
- frameGeometry() Of x(),y() and QWidget Of x(),y() It's the same , Indicates the position of the window in the display ,frameGeometry() Of width(),height() Is the width and height of the entire window including the title bar and border .
Qt Why provide 3 A coordinate system ? In order to solve the problem of cross platform , Cross operating system
matters needing attention
geometry() and frameGeometry() The geometric data in must be in show() Only valid after calling !!!
The size and position of the widget
QWidget Class provides Member functions :
Change the size of the widget
void resize(int w, int h)
void resize(const QSize &)
Change the position of the widget
void move(int x, int y)
void move(const QPoint &)
QPushButton Components
- QPushButton be used for Accept user click events
- QPushButton can Display the prompt string
- QPushButton yes Functional components , The parent component is required as the container
- QPushButton can Locate in the parent component
QWidget w; // Generate QWidget object , Top level components
QPushButton b(&w); // Generate QPushButton object , Its parent component is QWidget
b.setText("Button"); // Set the displayed string
b.move(10, 10); // Move to coordinates (10, 10)
b.resize(100, 25); // Set size width=100, height=25
Summary
Qt The geometric coordinates in The upper left corner is the origin
- Level is x Axis , From left to right is positive
- Vertical is y Axis , From top to bottom
Qt Medium GUI Components Position in the upper left corner
Qt The geometric coordinates in The upper left corner is the origin
- Level is x Axis , From left to right is positive
- Vertical is y Axis , From top to bottom
Qt Medium GUI Components Position in the upper left corner
Qt Of GUI Components can Set the size in the coordinate system
边栏推荐
猜你喜欢

Why is JSX syntax so popular?

Set up security groups, record domain names, and apply for SSL certificates

High performance and high availability computing architecture of "microblog comments" in microblog system

Sword finger offer 15 Number of 1 in binary

Sword finger offer 14- ii Cutting rope II

FPGA Development (1) -- serial port communication

Andorid source build/envsetup.sh 该知道的细节

How about counting Berry Pie 4? What are the possible ways to play?

剑指 Offer 14- II. 剪绳子 II

架构实战营模块5作业
随机推荐
Unity splashimage scaling problem
Sword finger offer 13 Range of motion of robot
The role of VMware virtual machine
Halcon实用:焊点检出设计思路
Cacti最大监控数测试
大厂试水 HPE推出Arm CPU通用服务器产品
AI首席架构师9-胡晓光 《飞桨模型库与行业应用》
西门子低代码 9.14版本: 满足不同需求
漫画安全HIDS、EDR、NDR、XDR
Profit distribution and taxation of funds
History of deep learning
[leetcode] a number that appears only once [136]
Solr basic operation 5
AI赋能新零售,「智」胜之道在于生态思维|数智夜话直播精选摘录
新钛云服荣膺“2022爱分析 · IT运维厂商全景报告”云管理平台CMP 代表厂商!...
LC: effective Sudoku + rotating image
QPainter的使用入门:绘制象棋界面
MetaQ集群安裝測試
Shell positional parameter variables and predefined variables
RRDTOOL draws MRTG log data