主要代码在(main()函数中)如下:
//设置窗体无边框
view.setWindowFlags(Qt::FramelessWindowHint);
//设置整个窗体背景为透明
view.setAttribute(Qt::WA_TranslucentBackground);
view.setStyleSheet("background:transparent;");
这里的view可以是:
QDeclarativeView view ;
或者
QmlApplicationViewer view;
上述代码中,设置背景为透明的,必须有(当然也是根据不同需求不一样)这两句,不然的话,背景还是会有白色。