1

My question is related to this one: Full-screen desktop application with QML

Here is my MWE:

import QtQuick 2.11
import QtQuick.Window 2.2
import QtQuick.Controls 2.2

Window
{
    property string windowFull: "FullScreen";
    property string windowWindowed: "Windowed";

    width: 400
    height: 400
    visible: true
    title: "Example"
    visibility: windowFull;
    id: theWindow;

    Button
    {
        onClicked:
        {
            if (theWindow.visibility === windowWindowed)
                theWindow.visibility = windowFull;
            else
                theWindow.visibility = windowWindowed;
        }
    }
}

In this example I am trying to go from windowed mode to full screen and vice versa when clicking the button. My problem is that going full screen from windowed mode works, but from full screen to windowed does not. Are there any special requirements that has to be made in order to go windowed mode from full screen?

halfer
  • 19,824
  • 17
  • 99
  • 186
Łukasz Przeniosło
  • 2,725
  • 5
  • 38
  • 74

1 Answers1

3

On Ubuntu, using Window.AutomaticVisibility is making the window visibilty as windowed (default window). Please check the QML window example.

import QtQuick 2.11
import QtQuick.Window 2.2
import QtQuick.Controls 2.2

Window
{
    property string windowFull: "FullScreen";
    property string windowWindowed: "Windowed";

    width: 400
    height: 400
    visible: true
    title: "Example"
    visibility: windowFull;
    id: theWindow;

    Button
    {
         onClicked:
        {
            if (theWindow.visibility === Window.FullScreen)
                theWindow.visibility = Window.AutomaticVisibility;
            else
                theWindow.visibility = Window.FullScreen;
        }
    }
}
nayab
  • 2,332
  • 1
  • 20
  • 34