Reputation: 422
I am new in Qt & QML, now I set a window and want to set it transparent, user can see my desktop cross my application.
I try to use WA_TranslucentBackground
and opacity
, however it doesn't work.
Here is my QML code, it's very simple:
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
}
}
Upvotes: 2
Views: 2321
Reputation: 12874
Window {
visible: true
color: "transparent"
//flags: Qt.Widget | Qt.FramelessWindowHint
}
Uncomment flags
if you want transparent window without frame
Upvotes: 3