Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to hide MaximizeButton of QMainWindow?
Forum Updated to NodeBB v4.3 + New Features

How to hide MaximizeButton of QMainWindow?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 5 Posters 9.5k Views 2 Watching
  • 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.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1

    This do not work:

    setWindowFlags(windowFlags() &~ Qt::WindowMaximizeButtonHint);

    https://github.com/sonichy

    raven-worxR 1 Reply Last reply
    0
    • sonichyS sonichy

      This do not work:

      setWindowFlags(windowFlags() &~ Qt::WindowMaximizeButtonHint);
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @sonichy

      setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint );
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      sonichyS 1 Reply Last reply
      3
      • raven-worxR raven-worx

        @sonichy

        setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint );
        
        sonichyS Offline
        sonichyS Offline
        sonichy
        wrote on last edited by
        #3

        @raven-worx This can disable maximize button but not hide it !

        https://github.com/sonichy

        raven-worxR 1 Reply Last reply
        0
        • sonichyS sonichy

          @raven-worx This can disable maximize button but not hide it !

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @sonichy
          i think there is no Qt-way to remove the minimize and maximize buttons.
          You may want to set the Qt::Tool flag instead the Qt::Window flag:

          setWindowFlags( Qt::Tool );
          

          But this also changes the appearance and behavior of the window a bit. But tool-windows do not have minimize and maximize buttons but do also not appear in the taskbar.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          sonichyS 1 Reply Last reply
          1
          • raven-worxR raven-worx

            @sonichy
            i think there is no Qt-way to remove the minimize and maximize buttons.
            You may want to set the Qt::Tool flag instead the Qt::Window flag:

            setWindowFlags( Qt::Tool );
            

            But this also changes the appearance and behavior of the window a bit. But tool-windows do not have minimize and maximize buttons but do also not appear in the taskbar.

            sonichyS Offline
            sonichyS Offline
            sonichy
            wrote on last edited by
            #5

            @raven-worx setFixedSize is more simple than setWindowFlags, but also disable Maximize button no hide it.

            https://github.com/sonichy

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi
              If Qt::Tool is not what you want, i think disable it is the only options.
              It will not be hidden unless a Tool type.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SaaGar
                wrote on last edited by SaaGar
                #7
                 this helped me:   Form.setMaximumSize(QtCore.QSize(width, height))
                

                class Ui_Form(object):

                def setupUi(self, Form):
                    
                    Form.setObjectName("Form")
                    Form.resize(328, 212)
                    Form.setMaximumSize(QtCore.QSize(352, 189))
                
                1 Reply Last reply
                0
                • Y Offline
                  Y Offline
                  YTech
                  wrote on last edited by
                  #8
                  This post is deleted!
                  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