Comments (1)
- frameGeometry: 包含了其父亲(window frame)的边框.
- geometry: 可以理解为当前widget真正的边框.
- rect: == (0, 0, width(), height());
注意与geometry的区别, 它是从左上角开始的边框.
这里重点说明下rect()和geometry()的区别:
看源码:
inline QRect QWidget::rect() const
{ return QRect(0,0,data->crect.width(),data->crect.height()); }
inline const QRect &QWidget::geometry() const
{ return data->crect; }
可以得知它俩都是来自QWidgetData()的成员指针crect. 但区别在于 rect() 始终从坐标原点开始计算。而geometry是根据窗口像素位置来确定的。但两者大小永远一致。这么说可能还是不太清楚。做个简单的实验: 43aec9d
运行一下Playground, 并拖动窗口,看输出。就可以清晰的看出这两者的区别了。
geometry().width() == width();
geometry().height() == height();
其示意图如下图所示:
- contentRect: 边缘内部的边框, 在geometry的内部.
- normalGeometry: 这个指的是当前widget在正常情况下(没有最大化或全屏)的边框.
- childrenRect: 获取子widget的边框, 如果没有孩子, 长宽皆为0.
see the debug out at here
from qtlab.
Related Issues (12)
- 如何制作一个自适应缩放的坐标轴 HOT 18
- 通过 QLinearGradient 进行线性插值之后,如何获取中间某位置的特定颜色? HOT 14
- 如何设置界面风格? HOT 2
- vs2010下无法创建Translation File HOT 1
- 想学习下Qt,讨论一下关注点. HOT 16
- 如何计算字体的像素信息(长度?宽度?) HOT 1
- 如何在 Xcode 中进行 Qt 开发? HOT 1
- 如何获取鼠标滚轮滚过的距离? HOT 1
- 如何在QPainter里用鼠标滑动一根线。 HOT 2
- 如何变换鼠标的指针形状?都有哪些指针形状? HOT 1
- 能不能对QPainter中的线条增加右键菜单?并通过菜单修改颜色或删除? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qtlab.