[solved]Testing ApplicationWindow.visibility enum values?
Unsolved
QML and Qt Quick
-
Very basic question:
I am playing around with making a routine to toggle a QtQuick app fullscreen (code below) and find that I can't test the enum QWindow::Visibility by the const name but only by the value. i.e. I can't do this: if ( window.visibility == QWindow.FullScreen)
I must be doing it wrong but I've tried a few syntax variations.
(alternately, is there a cleaner way of doing what I am trying to do?)
import QtQuick.Controls 1.4 ApplicationWindow { id: window visible: true visibility: "Windowed" width: 1024 height: 768 Button { id: button text: "FullScreen" onClicked: toggleFullScreen() } function toggleFullScreen(){ console.log(window.visibility) if ( window.visibility == 5){ window.visibility = "Windowed" button.text = "FullScreen" } else if ( window.visibility == 2){ window.visibility = "FullScreen" button.text = "Windowed" } } }
-
Hi @TOMATO_QT
You can useWindow.FullScreen
orWindow.Windowed
. Justimport QtQuick.Window 2.0
or greater.