2017-07-18 63 views
0

我創建了一個透明的qml窗口,一切正常,直到我將我的Windows 7主題更改爲經典,我希望它是透明的區域是黑色。qt在Windows 7經典主題快速透明窗口

#include <QGuiApplication> 
#include <QQmlApplicationEngine> 
#include <QtQuick> 

int main(int argc, char *argv[]) 
{ 
    QGuiApplication app(argc, argv); 
// QQuickWindow::setDefaultAlphaBuffer(true); 
    QQmlApplicationEngine engine; 
    engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); 
    if (engine.rootObjects().isEmpty()) 
     return -1; 

    return app.exec(); 
} 

和我讀設爲Qml

import QtQuick 2.6 
import QtQuick.Window 2.2 
import QtGraphicalEffects 1.0 

Window { 
    id: window 
    visible: true 
    width: 640 
    height: 480 
    color: "#00000000" 
    flags: Qt.Window | Qt.FramelessWindowHint//去掉標題欄 

    RectangularGlow { 
     anchors.fill: background 
     glowRadius: 10 
     spread: 0 
     cornerRadius: 10 
     color: "#99999999" 
    } 

    Rectangle{ 
     id: background 
     anchors.topMargin: 50 
     anchors.centerIn: parent 
     radius: 15 
     width: parent.width *2/3 
     height: parent.height - 10 
     color: "#ffdbeef5" 
    } 

} 

任何人有一些想法?

Here is a screenshot

回答