Open new fullscreen qml window and close/hide current fullscreen window
-
I am using qt 5.2.1 on nvidia TX1 running Ubuntu 14.04.
I want open new fullscreen Windows without boarders from currently running fullscreen qml.I have 2 qml files
- startup.qml
- Preview.qml
On startup, startup.qml is loaded
main.cppint main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:///qml/qml/startup.qml"))); return app.exec(); }
startup.qml
import QtQuick 2.2 import QtQuick.Window 2.0 import QtQuick.Controls 1.1 ApplicationWindow { id: rootWindow width: Screen.width height: Screen.height visible: true visibility: Window.FullScreen Item { focus: true Timer { interval: 2500 running: true; onTriggered: { var component = Qt.createComponent("qrc:///qml/qml/Preview.qml") var window = component.createObject(rootWindow) rootWindow.visible = false window.show() } } } }
Preview.qml
import QtQuick 2.0 import QtQuick.Window 2.0 import QtQuick.Controls 1.1 ApplicationWindow { id: rootWindow width: Screen.width height: Screen.height visible: true visibility: Window.FullScreen }
After timer delay startup.qml is getting closed and new Preview.qml window appears. But the problem is that it appears in window with boarder and ubuntu unity side pane.
So how can i open second windows also in fullscreen mode?
-
Hello, you need to set window flag to avoid drawing borders.
flags: Qt.Window | Qt.FramelessWindowHint
-
Thanks for the Reply.
I will try your solution also.
But i found one solution.I just replaced
window.show()
in startup.qml to
window.showFullScreen()
And this fulfills my requirements.