QWidget 之paint部分杂记(从Qt4.0到4.8的进化,在Qt 4.4中,Alien Widget诞生了)
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://labs.qt.nokia.com/2009/12/16/qt-graphics-and-performance-an-overview/
http://labs.qt.nokia.com/2008/02/04/qt-44-and-painting-performance/
http://labs.qt.nokia.com/2008/05/12/qwidget-vs-graphics-view-ding-ding-ding
http://labs.qt.nokia.com/2007/08/09/qt-invaded-by-aliens-the-end-of-all-flicker/
http://blog.csdn.net/dbzhang800/article/details/6835722
QWidget 之paint部分杂记(从Qt4.0到4.8的进化,在Qt 4.4中,Alien Widget诞生了)的更多相关文章
- 第0课 - 搭建开发环境之安装QT
第0课 - 搭建开发环境之安装Qt 1. 课程学习的原材料 — Visual Studio 2010 — Qt SDK 4.7.4 — Qt Creator 2.4.1 2. Visual Studi ...
- 与众不同 windows phone (37) - 8.0 文件系统: StorageFolder, StorageFile, 通过 Uri 引用文件, 获取 SD 卡中的文件
[源码下载] 与众不同 windows phone (37) - 8.0 文件系统: StorageFolder, StorageFile, 通过 Uri 引用文件, 获取 SD 卡中的文件 作者:w ...
- Qt中各个widget前后位置的设定(在Qt中,所有问题都要一分为二,QWidget体系和QGraphicsWidget体系)
这两天在总结一些以往project中遇到的问题,正好别组有同事问我关于Qt中各个widget窗口的前后位置是如何定义的,这里就总结一下: 在Qt中,所有问题都要一分为二,讨论两种不同的情况:一个是最常 ...
- 返璞归真 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 上传文件, ...
- 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 ...
- 浅谈[0,1]区间内的n个随机实数变量中增加偏序关系类题目的解法
浅谈[0,1]区间内的n个随机实数变量中增加偏序关系类题目的解法 众所周知,把[0,1]区间内的n个随机.相互独立的实数变量\(x_i\)之间的大小关系写成一个排列\(\{p_i\}\),使得\(\f ...
- Zabbix 4.0.2试用(七):在Linux主机中安装zabbix agent并添加该主机(yum源安装)
Zabbix 4.0.2试用(七):在Linux主机中安装zabbix agent并添加主机(yum源安装) 2018年12月20日, 上午6:42 之前介绍的是下载源安装包,编译安装的方式来安装ag ...
- C、算法、操作系统杂记《malloc 0大小是什么行为》
linux手册上的说明 If size is 0, then malloc() returns either NULL, or a unique pointer value that can late ...
- Qt4学习笔记 (7) 本篇说一下Qt对于脚本的支持, 即QtScript模块.
本篇说一下Qt对于脚本的支持, 即QtScript模块. Qt支持的脚本基于ECMAScript脚本语言, 这个东西又是javascript, jscript的基础. 所以, 一般只要学过javasc ...
随机推荐
- iOS:实现图片的无限轮播---之使用第三方库SDCycleScrollView
SDCycleScrollView API // // SDCycleScrollView.h // SDCycleScrollView #import <UIKit/UIKit.h> ...
- PDO中获取结果集
fetch()方法 fetch()方法用于获取结果集的下一行.语法例如以下: mixed PDOStatement::fetch([int fetch_style][,int cursor_orien ...
- 自己定义Dialog的具体步骤(实现自己定义样式一般原理)
转载请标注转载http://blog.csdn.net/oqihaogongyuan/article/details/50958659 自己定义Dialog的具体步骤(实现自己定义样式一般原理) ...
- javascript 调用C++函数
分3步: 一>实现IDispatch 接口 #ifndef _IDISPIMP_H_ #define _IDISPIMP_H_ // idispimp.h class CImpIDispatch ...
- 【26.83%】【Codeforces Round #380C】Road to Cinema
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- Ubuntu UEFI 模式下安装基本原则
https://help.ubuntu.com/community/UEFI Introduction The Extensible Firmware Interface (EFI) or its v ...
- php 小程序获取渠道二维码 保存
function ppost($url,$arr){ $post_data = json_encode($arr); $url=$url; $ch = curl_init(); curl_setopt ...
- POJ - 2286 - The Rotation Game (IDA*)
IDA*算法,即迭代加深的A*算法.实际上就是迭代加深+DFS+估价函数 题目传送:The Rotation Game AC代码: #include <map> #include < ...
- Lucene学习总结之七:Lucene搜索过程解析 2014-06-25 14:23 863人阅读 评论(1) 收藏
一.Lucene搜索过程总论 搜索的过程总的来说就是将词典及倒排表信息从索引中读出来,根据用户输入的查询语句合并倒排表,得到结果文档集并对文档进行打分的过程. 其可用如下图示: 总共包括以下几个过程: ...
- 用Java对CSV文件进行读写操作
需要jar包:javacsv-2.0.jar 读操作 // 读取csv文件的内容 public static ArrayList<String> readCsv(String filepa ...