Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-132337

Removing window maximize button removes close button Windows 11

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.8.1
    • GUI: Window management
    • None
    • Windows

    Description

      The Pyside6 v6.8.1 example code below removes the window flag WindowMaximizeButtonHint to remove the maximize button of a window, but now also removes the close button:

      from PySide6.QtWidgets import QApplication, QLabel
      from PySide6.QtCore import Qt
      import sys
      
      
      def main():
          # Create application
          app = QApplication(sys.argv)
      
          # Create window from QLabel
          window = QLabel('Example')
          # Resize window
          window.resize(300, 150)
      
          # Bug: Line below should remove the maximize button only, but also removes the close button on Windows 11:
          window.setWindowFlags(window.windowFlags() & ~Qt.WindowMaximizeButtonHint)
          
          # Removing the close button only works:
          # To test this, uuncomment line below, comment out line above
          # window.setWindowFlags(window.windowFlags() & ~Qt.WindowCloseButtonHint)
      
          # Show window
          window.show()
      
          # Main loop
          sys.exit(app.exec())
      
      
      if __name__ == '__main__':
          main() 

      This worked with previous Pyside6 v6.7.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            owolff Oliver Wolff
            erriez Erriez Ew
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes