当前位置:网站首页>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
边栏推荐
- Cartoon security HIDS, EDR, NDR, XDR
- Matlab exercises -- program control process exercise
- Solr basic operation 2
- Solr basic operation
- What is IGMP? What is the difference between IGMP and ICMP?
- 大厂试水 HPE推出Arm CPU通用服务器产品
- AI empowers new retail, the way to win "wisdom" lies in ecological thinking | selected excerpts from digital intelligence night talk live broadcast
- 请指教什么是在线开户?另外,手机开户安全么?
- Golang6 reflection
- Et la tarte aux framboises 4? Quels sont les jeux possibles?
猜你喜欢

Leetcode(76)——最小覆盖子串

Matlab exercises -- program control process exercise

机器学习:VC维的概念和用途

6.29日刷题题解

Construction of module 5 of actual combat Battalion

Cartoon security HIDS, EDR, NDR, XDR

FPGA Development (1) -- serial port communication

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

Yunhe enmo Guoqiang, identifiez - le, saisissez - le, avant l'ébullition de la base de données nationale

LC: maximum subarray and
随机推荐
How to view the CPU cores and threads in win11? Win11 view the tutorial of how many cores and threads the CPU is
Leetcode(633)——平方数之和
Yunhe enmo, gaiguoqiang, identify it and grasp it before the domestic database boils
Cacti settings for spin polling
Sword finger offer 14- ii Cutting rope II
The concept and significance of mean, variance, standard deviation and covariance
This simple little function saves 213 hours for our production research team in half a year
二叉搜索树 230. 二叉搜索树中第K小的元素 1038. 从二叉搜索树到更大和树
这个简单的小功能,半年为我们产研团队省下213个小时
matlab习题 —— 程序控制流程练习
History of deep learning
小程序插件接入、开发与注意事项
Embedded development: Hardware in the loop testing
一步步教你在Edge浏览器上安装网风笔记
云和恩墨盖国强,识别它、抓住它,在国产数据库沸腾以前
How to write controller layer code gracefully?
[Shangshui Shuo series] day 8
Andorid source build/envsetup.sh 该知道的细节
25 interview questions about Apache
數莓派 4怎麼樣?可能的玩法有哪些?