找回密码
 立即注册
收起左侧

求注释

1
回复
5542
查看
[复制链接]
累计签到:10 天
连续签到:1 天
来源: 2014-2-20 15:26:03 显示全部楼层 |阅读模式

马上注册,查看详细内容!注册请先查看:注册须知

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
各位大神小弟在做不规则窗体时遇到的这几个函数 但不知道是干嘛的现在功能已近完成想加注释但不知道干嘛的

setWindowFlags(Qt::FramelessWindowHint);  //去除标题栏
setAttribute(Qt::WA_NoSystemBackground);         
setAttribute(Qt::WA_TranslucentBackground);         //使窗体透明               
setAttribute(Qt::WA_OpaquePaintEvent, true);


void SetWindowRgnTest::paintEvent(QPaintEvent *)   //重写绘画事件
{
        QPainter painter(this);
        QRect qr=geometry();
        painter.drawPixmap(QRect(0, 0, qr.width(), qr.height()), QPixmap("image/hallbg.png"));

}

还有重写绘画事件的作用是什么
以及 geometry()是得到那个的大小
谢谢
回复

使用道具 举报

累计签到:894 天
连续签到:1 天
2014-2-20 15:34:04 显示全部楼层
你把鼠标定位到setAttribute中,按F1查看帮助,可以看到Qt::WA_NoSystemBackground,Qt::WA_OpaquePaintEvent, true等枚举变量的含义。
你也可以在Qt Assistant中搜索。
我查了一下,WA_NoSystemBackground英文解释是Indicates that the widget has no background, i.e. when the widget receives paint events, the background is not automatically repainted. Note: Unlike WA_OpaquePaintEvent, newly exposed areas are never filled with the background (e.g., after showing a window for the first time the user can see "through" it until the application processes the paint events). This flag is set or cleared by the widget's author.
WA_OpaquePaintEvent英文解释是Indicates that the widget paints all its pixels when it receives a paint event. Thus, it is not required for operations like updating, resizing, scrolling and focus changes to erase the widget before generating paint events. The use of WA_OpaquePaintEvent provides a small optimization by helping to reduce flicker on systems that do not support double buffering and avoiding computational cycles necessary to erase the background prior to painting. Note: Unlike WA_NoSystemBackground, WA_OpaquePaintEvent makes an effort to avoid transparent window backgrounds. This flag is set or cleared by the widget's author.
后面的我也不是很明白,不过你可以自己查下Qt Assistant。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了