Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [solved]Testing ApplicationWindow.visibility enum values?

[solved]Testing ApplicationWindow.visibility enum values?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qwindow
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on 29 Oct 2015, 22:14 last edited by A Former User
    #1

    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"
           }
        }
    }
    P 1 Reply Last reply 31 Oct 2015, 14:40
    0
    • ? A Former User
      29 Oct 2015, 22:14

      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"
             }
          }
      }
      P Offline
      P Offline
      p3c0
      Moderators
      wrote on 31 Oct 2015, 14:40 last edited by
      #2

      Hi @TOMATO_QT
      You can use Window.FullScreen or Window.Windowed. Just import QtQuick.Window 2.0 or greater.

      157

      ? 1 Reply Last reply 31 Oct 2015, 14:53
      0
      • P p3c0
        31 Oct 2015, 14:40

        Hi @TOMATO_QT
        You can use Window.FullScreen or Window.Windowed. Just import QtQuick.Window 2.0 or greater.

        ? Offline
        ? Offline
        A Former User
        wrote on 31 Oct 2015, 14:53 last edited by
        #3

        @p3c0

        Hey thanks! Works as expected.
        Another baby step on the road to writing more interesting bugs. . . ;-)

        1 Reply Last reply
        0

        1/3

        29 Oct 2015, 22:14

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved