您的位置:首页 > 编程语言 > Qt开发

QPixmap的使用+QSplashScreen的使用

2017-07-15 09:28 489 查看
1.设置窗口运行为图片

效果图:



实现代码:

//设置窗口运行为图片--QPixmap的使用
QPixmap pix;
pix.load("iocn.png",0,Qt::AvoidDither|Qt::ThresholdDither|Qt::ThresholdAlphaDither);
resize(pix.size());
setMask(QBitmap(pix.mask()));

void paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.drawPixmap(0,0,QPixmap("iocn.png"));
}


2.设置窗口运行前的弹框图片提示

效果图:



实现代码:

//设置窗口运行前的弹框图片提示--QSplashScreen的使用
QPixmap pixmap("Qt.png");
QSplashScreen splash(pixmap);
splash.show();
a.processEvents();
MainWindow w;
w.show();
splash.finish(&w);
//MainWindow构造函数中内容
Sleep(3000);//添加#include <windows.h>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  qt QPixmap SplashScre