声明:因网易博客将关闭,移到此
这里是设置使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());
}