声明:因网易博客将关闭,移到此
这里是设置使QDeclarativeView 透明,注意目前只在windows xp下测试成功,ubuntu上失败。
QDeclarativeView w;
w.setWindowFlags(Qt::FramelessWindowHint);
w.setAttribute(Qt::WA_TranslucentBackground);
w.setStyleSheet("background:transparent");
w.setSource(QUrl("../QMLApplication/app.qml"));
w.show();
QObject::connect(w.engine(), SIGNAL(quit()), &w, SLOT(close()));
// 看看有什么错误
QList<QDeclarativeError> errlist = w.errors();
for (int i = 0; i < errlist.size(); i++)
{
qDebug("%s", errlist.at(i).toString().toLocal8Bit().data());
}
本文介绍如何在QDeclarativeView中设置窗口为透明,包括使用Qt属性和样式表实现无边框和背景透明效果。代码示例在Windows XP下测试成功,但在Ubuntu上未能生效。
2276

被折叠的 条评论
为什么被折叠?



