[Solved] How to make full screen in qt quick?
-
I use Qt 5.2.1 with Qt Creator recently. I get full screen for qt widgets application with code:
@QApplication a(argc, argv);
Widget w;
w.showFullScreen();
w.show();
return a.exec();@For qt quick application with code below, no full screen is displayed.
@QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral(“qml/main.qml”));
viewer.showFullScreen();
viewer.showExpanded();
return app.exec();@Does anyone know how to get full screen in qt quick? Thanks a lot.
-
Thanks for your reply. It has not worked in Windows 7, 8 and Android.
Maybe another way is building a widgets application and using QDeclarativeItem? I'm not sure about it. Did anyone meet the same problem? -
It worked if delete viewer.showExpanded();
-
Alternatively, you can solve this using only qml; this has the advantage that the qml content is initially rendered in an already fullscreen window and signal onWindowStateChanged is not called twice:
@
import QtQuick.Window 2.2 // Window.FullScreen
import QtQuick.Controls 1.3 // ApplicationWindow// Note for OS X: using Window instead of ApplicationWindow only hides the dock (and shows it again when app is quit)
ApplicationWindow {id: mainWindow visible: true // this is mandatory visibility: Window.FullScreen onWindowStateChanged: { console.log( "onWindowStateChanged (Window), state: " + windowState ); }
}
@
-
Alternatively, you can solve this using only qml; this has the advantage that the qml content is initially rendered in an already fullscreen window and signal onWindowStateChanged is not called twice:
@
import QtQuick.Window 2.2 // Window.FullScreen
import QtQuick.Controls 1.3 // ApplicationWindow// Note for OS X: using Window instead of ApplicationWindow only hides the dock (and shows it again when app is quit)
ApplicationWindow {id: mainWindow visible: true // this is mandatory visibility: Window.FullScreen onWindowStateChanged: { console.log( "onWindowStateChanged (Window), state: " + windowState ); }
}
@