Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Restored window after minimizing is not maximized

    QML and Qt Quick
    minimize visibility button window qml
    1
    3
    543
    Loading More Posts
    • 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.
    • K
      Krakenus00 last edited by Krakenus00

      I'm trying to implement my own window frame for a desktop application. I have already done the borders and the top bar. There are only buttons what's left. So the problem is that my window restores windowed after minimizing even being at the Maximized state before minimizing.
      Here is my code for buttons:
      Maximizing button:

      onReleased:
      {
          mx_btn.highlighted = false
          if(app_window.visibility == 2) // Windowed
              app_window.showMaximized()
          else
              app_window.showNormal()
      }
      

      Minimizing button:

      onReleased:
      {
          mn_btn.highlighted = false
          app_window.showMinimized()
      }
      

      Application window props:

      ApplicationWindow
      {
          id: app_window
         
          ...
      
          flags: Qt.Window | Qt.FramelessWindowHint
          visible: true
      
          ...
      
          visibility: isFullWindow? Window.Maximized : Window.Windowed
      
          ...
      }
      
      1 Reply Last reply Reply Quote 0
      • K
        Krakenus00 last edited by

        I have no better idea than to rewrite all this stuff to QtWidgets with native support. I'll try to embed the main context using QML, but the window will be QtWidgets.

        1 Reply Last reply Reply Quote 0
        • K
          Krakenus00 last edited by

          Omg, I've just ORed the flags, and now it works as intended.
          In QtWidgets it should be:

          	// To set the window minimized
          	setWindowState(windowState() & ~Qt::WindowActive | Qt::WindowMinimized);
          	// To restore the window from minimized state
          	setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
          

          So in QML it should work in the same way.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post