Full-screen desktop application with QML

iceman picture iceman · Jan 26, 2012 · Viewed 26k times · Source

I have experience with developing rich user interface application with flex and AS3. However the issue is its very hard to use existing c++ business logic with these flex apps. With the advent of QML, I am curious whether its possible to reuse the c++ business logic with QT for rich UI apps.

I want to know whether its possible to develop full screen rich user interface applications(which are becoming more and more common especially in mobile devices) for the desktop. For example(http://blog.flexexamples.com/2007/08/07/creating-full-screen-flex-applications/) Adobe has the Flash Player which can be used in full screen mode and runs content written in AS3. Is it possible to write similar applications using QT/QML?

Answer

JuSchu picture JuSchu · Jun 6, 2014

There is also a QML-only way to go fullscreen. You can use this if you are not using QDeclarativeView but QQmlApplicationEngine, since the latter doesn't inherits QWidget and has not the method showFullScreen().

import QtQuick 2.2
import QtQuick.Controls 1.1

ApplicationWindow {
    id: window
    visible: true
    visibility: "FullScreen"
    width: 640
    height: 480

    Button {
        text: "exit fullscreen"
        onClicked: window.visibility = "Windowed"
    }
}

But it's important to use ApplicationWindow as the root-element and not Rectangle. For ApplicationWindow you have to import QtQuick.Controls.