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. Restored window after minimizing is not maximized
QtWS25 Last Chance

Restored window after minimizing is not maximized

Scheduled Pinned Locked Moved Solved QML and Qt Quick
minimizevisibilitybuttonwindowqml
3 Posts 1 Posters 1.8k 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.
  • K Offline
    K Offline
    Krakenus00
    wrote on last edited by Krakenus00
    #1

    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
    0
    • K Offline
      K Offline
      Krakenus00
      wrote on last edited by
      #2

      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
      0
      • K Offline
        K Offline
        Krakenus00
        wrote on last edited by
        #3

        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
        0

        • Login

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