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. Can not hide window after called showNormal() when window is FullScreen state

Can not hide window after called showNormal() when window is FullScreen state

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 238 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.
  • D Offline
    D Offline
    Dylan Deng
    wrote on last edited by
    #1

    This following code shows the problem on macOS. I can't hide the window after called showNormal() function, the window keeps showing. What the best way to hide window after called showNormal() when window is FullScreen?

    I'm using Qt 5.14.2/5.15.0
    OS: macOS 10.15.6

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Layouts 1.12
    
    Window {
        id: mainWindow
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        Component.onCompleted: {
            mainWindow.showFullScreen()
        }
    
        RowLayout {
            anchors.centerIn: parent
    
            Button {
                text: qsTr('Hide')
                onClicked: {
                   if (mainWindow.visibility === Window.FullScreen) {
                       mainWindow.showNormal()
                       mainWindow.visible = false
                   } else {
                       mainWindow.visible = false
                   }
                }
            }
        }
    }
    
    1 Reply Last reply
    0

    • Login

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