Qt 4.0

automatically double-buffers

Qt 4.1

QWidget::autoFillBackground

Qt 4.2

delayed widget creation (DWC)

stylesheet

Qt 4.3

QWidget::render

Qt 4.4

Alien Widget

Qt 4.5

Translucent Windows

Qt 4.6

widget's graphics effect

Qt 4.8

lighthouse (qpa)

Qt4.0

  • 在Qt 4.0中,启用双缓冲,不必在paintEvent()中编写双缓冲代码来避免闪烁。

Qt4.1

  • 在Qt 4.1中,通过启用背景自动传递(propagation),widget不再有任何默认的背景。引入backingstore这个东西。

Qt4.2

  • 在Qt 4.2中,延时控件创建(delayed widget creation)的引入,使得widget可以在没有真实窗口句柄的情况下被创建。

QWindowSurface 与 QWidgetBackingStore

Even though QWidget is a QPaintDevice subclass, one will never render directly into a QWidget’s surface. Instead, during the paintEvent, the painting is redirected to an offscreen surface which is represented by the internal class QWindowSurface.

QWidgetBackingStore is responsible for figuring out which parts of the window surface needs to be updated prior to showing it to screen, so its really a repaint manager.

When the concept of backingstore was introduced in Qt 4.1, the two classes were the same, but the introduction of more varying ways to get content to screen made us split it in two.

Qt4.4

  • 在Qt 4.4中,Alien Widget诞生了,这样一来,Window和Widget尽管仍是同一个类,却是不同的东西。Window负责与窗口系统的联系。Alien被号称是所有闪烁的终结者,见Qt Invaded By Aliens — The End of All Flicker

Qt::WA_NativeWindow

创建原生窗体,即带句柄

Qt::WA_PaintOnScreen

强制创建原生窗体

Qt::Window

顶级窗口,必须是原生窗体 (?)

QGLWidget

必须是原生窗体

如果一个widget已经是alien Widget,如果对其设置上述标志,或者对其调用winId()函数,都会导致其重新创建为一个native widget。

Qt4.5

  • 在Qt 4.5中,graphics system的概念被引入(比如选项有:raster|opengl|x11|native 等)。引人了一个Qt::WA_TranslucentBackground 属性,这个东西和QWidget::setWindowOpacity()有些比较容易混哈。

QWidget::setWindowOpacity()函数,设置窗体(即:isWindow()为真的widget)的整体不透明度, 从0.0到1.0之间, 值越大越不透明。

Qt::WA_TranslucentBackground,这个属性每个QWidget都可以单独设置。不被绘制的区域(背景)都是透明的,绘制的区域的透明程度通过颜色或图片的Alpha Channel值来控制。

Qt4.6

  • 在Qt 4.6中,graphics effect被引入。但是,现在,已经不建议使用:
Graphics Effects
State: Deprecated
Reasoning: flawed design, we don’t recommend taking maintainership of this code.

QGraphicsEffect 的子类需要重新实现draw()函数。

以安装了QGraphicsOpacityEffect了QWidget为例,当每次需要重绘时,QWidgetPrivate::drawWidget()不是发送QPaintEvent事件,以调用我们的paintEvent()函数;而是调用QGraphicsOpacityEffect的draw()函数,该函数内,通过QWidget::render()调用paintEvent()将内容绘制在一个QPixmap中,而后设置QPainter的不透明度,绘制QPixmap到目标。

Qt4.8

  • 在Qt 4.8中,正式引入lighthouse了,...

参考

http://blog.csdn.net/dbzhang800/article/details/6835722

QWidget 之paint部分杂记(从Qt4.0到4.8的进化,在Qt 4.4中,Alien Widget诞生了)的更多相关文章

  1. 第0课 - 搭建开发环境之安装QT

    第0课 - 搭建开发环境之安装Qt 1. 课程学习的原材料 — Visual Studio 2010 — Qt SDK 4.7.4 — Qt Creator 2.4.1 2. Visual Studi ...

  2. 与众不同 windows phone (37) - 8.0 文件系统: StorageFolder, StorageFile, 通过 Uri 引用文件, 获取 SD 卡中的文件

    [源码下载] 与众不同 windows phone (37) - 8.0 文件系统: StorageFolder, StorageFile, 通过 Uri 引用文件, 获取 SD 卡中的文件 作者:w ...

  3. Qt中各个widget前后位置的设定(在Qt中,所有问题都要一分为二,QWidget体系和QGraphicsWidget体系)

    这两天在总结一些以往project中遇到的问题,正好别组有同事问我关于Qt中各个widget窗口的前后位置是如何定义的,这里就总结一下: 在Qt中,所有问题都要一分为二,讨论两种不同的情况:一个是最常 ...

  4. 返璞归真 asp.net mvc (11) - asp.net mvc 4.0 新特性之自宿主 Web API, 在 WebForm 中提供 Web API, 通过 Web API 上传文件, .net 4.5 带来的更方便的异步操作

    原文:返璞归真 asp.net mvc (11) - asp.net mvc 4.0 新特性之自宿主 Web API, 在 WebForm 中提供 Web API, 通过 Web API 上传文件, ...

  5. TensorFlow 1.2.0新版本完美支持Python3.6,windows在cmd中输入pip install tensorflow就能下载应用最新tensorflow

    TensorFlow 1.2.0新版本完美支持Python3.6,windows在cmd中输入pip install tensorflow就能下载应用最新tensorflow 只需在cmd中输入pip ...

  6. 浅谈[0,1]区间内的n个随机实数变量中增加偏序关系类题目的解法

    浅谈[0,1]区间内的n个随机实数变量中增加偏序关系类题目的解法 众所周知,把[0,1]区间内的n个随机.相互独立的实数变量\(x_i\)之间的大小关系写成一个排列\(\{p_i\}\),使得\(\f ...

  7. Zabbix 4.0.2试用(七):在Linux主机中安装zabbix agent并添加该主机(yum源安装)

    Zabbix 4.0.2试用(七):在Linux主机中安装zabbix agent并添加主机(yum源安装) 2018年12月20日, 上午6:42 之前介绍的是下载源安装包,编译安装的方式来安装ag ...

  8. C、算法、操作系统杂记《malloc 0大小是什么行为》

    linux手册上的说明 If size is 0, then malloc() returns either NULL, or a unique pointer value that can late ...

  9. Qt4学习笔记 (7) 本篇说一下Qt对于脚本的支持, 即QtScript模块.

    本篇说一下Qt对于脚本的支持, 即QtScript模块. Qt支持的脚本基于ECMAScript脚本语言, 这个东西又是javascript, jscript的基础. 所以, 一般只要学过javasc ...

随机推荐

  1. AES 加密解密

    package XX.XX.XX.test; import java.io.IOException; import java.io.UnsupportedEncodingException; impo ...

  2. 【Codeforces Round #435 (Div. 2) B】Mahmoud and Ehab and the bipartiteness

    [链接]h在这里写链接 [题意] 让你在一棵树上,加入尽可能多的边. 使得这棵树依然是一张二分图. [题解] 让每个节点的度数,都变成二分图的对方集合中的点的个数就好. [错的次数] 0 [反思] 在 ...

  3. JS冲突解决方法

    Prototype   jquery 冲突解决: 在页面中同时存在jquery 和 prototype ,当用到 $ 的时候,难免产生冲突,所以一定要区分开来: <script type=&qu ...

  4. stm32的pwm波

  5. ConcurrentHashMap 内部实现分析

    ConcurrentHashMap ConcurrentHashMap是一个线程安全的Hash Table,它的主要功能是提供了一组和HashTable功能相同但是线程安全的方法.Concurrent ...

  6. php 上传文件大小控制配置文件中设置的

    Windows 环境下的修改方法 ================================================================第一步:修改在php5下POST文件大 ...

  7. [Angular Directive] Combine HostBinding with Services in Angular 2 Directives

    You can change behaviors of element and @Component properties based on services using @HostBinding i ...

  8. RESET MASTER 和RESET SLAVE 命令的使用方法 注意事项

    RESET MASTER 删除所有index file 中记录的所有binlog 文件,将日志索引文件清空,创建一个新的日志文件,这个命令通常仅仅用于第一次用于搭建主从关系的时的主库,注意  rese ...

  9. 【codeforces 755B】PolandBall and Game

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  10. [Angular] Using directive to create a simple Credit card validator

    We will use 'HostListener' and 'HostBinding' to accomplish the task. The HTML: <label> Credit ...