Reputation: 4323
I've experienced a strange problem: when a QML Window
is fullscreen, its opacity
property doesn't work, so the window stay opaque. When the window isn't fullscreen (e.g. maximized), it works properly.
Do you have any ideas how to deal with this problem? In fact, I want to animate fullscreen window fading in.
The code:
main.qml
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Window 2.1
Window {
visible: true
visibility: "FullScreen"
opacity: 0.5
Text {
id: text
text: "Hello World"
font.pointSize: 36
color: "#333"
}
}
main.cpp
#include <QApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
return app.exec();
}
I use Qt 5.3 on Windows 8.1.
Upvotes: 4
Views: 1675
Reputation: 14603
This is the age-old bug of the Qt/Win combination - windows with an OpenGL context, can't be made transparent without employing trickery. The solution is to embed your QML application in a QQuickWidget
and make that transparent and full-screen. There also exists another workaround (using the 'DWM' API, which is nonportable - you can read about it in the bug description).
https://bugreports.qt.io/browse/QTBUG-28214
Upvotes: 5