|
又是来结贴的,顺便记录一下
图中hello world是用qml写的
图片是用qt c++的label控件显示的
把qml当做widget载入,实现窗体的无边框,透明化
布局可以采用绝对位置定位
具体关键一点儿的代码如下:
QDeclarativeView *qmlView = new QDeclarativeView(this);
qmlView->setGeometry(0,0,300,300);
qmlView->setWindowFlags(Qt::FramelessWindowHint);//无边框
qmlView->setAttribute(Qt::WA_TranslucentBackground);//窗体透明
qmlView->setStyleSheet("background:transparent");
qmlView->setSource(QUrl::fromLocalFile("qml/callQml/main.qml"));
qml文件代码中关键的一句是要设置父对象的颜色:color: "#00000000"
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|