1
我是Qt新手& QML,現在我設置了一個窗口並想將其設置爲透明,用戶可以看到我的桌面跨越我的應用程序。 我嘗試使用WA_TranslucentBackground
和opacity
,但它不起作用。如何設置由Qt 5.6透明的QML應用程序窗口?
這裏是我的QML代碼,這是非常簡單的:
import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
Window {
visible: true
width: Screen.width
height: Screen.height
title: qsTr("Input")
flags: Qt.WA_TranslucentBackground | Qt.FramelessWindowHint
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
}
如果我想設置背景顏色爲RGBA(0,0 ,0,0.6),用戶也可以看到我的應用程序背後的任何內容,我該怎麼做? – AdvancingEnemy
只需設置'color:Qt.rgba(0,0,0,0.6)'。 – folibis
你也可以嘗試不透明度:0.5例如 –