Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. close bottom window of QMainWindow

close bottom window of QMainWindow

Scheduled Pinned Locked Moved Unsolved Qt for Python
7 Posts 3 Posters 336 Views 1 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.
  • C Offline
    C Offline
    C.J. Mejias
    wrote last edited by
    #1

    Hi, I am new in python and pyside6.

    I have the following problem:
    Using python 3.10 (and pyside 3.9) with this statement:
    self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)
    (self is a QMainwindow object).

    The window is open correctly, showing just the close button.

    When I use python 3.14.2, with pyside 6.10., the window appear with just close botton, but the botton appear disabled.

    How I could enable this botton in this version o pyside.

    Thanks...

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi and welcome to devnet,

      On which OS are you experiencing this ?
      Which version of 6.10 do you have ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        C.J. Mejias
        wrote last edited by
        #3

        Hi,

        Thank you for your reply.

        We are working on Windows 11
        PySide 6.10.1

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote last edited by
          #4

          Can you share a minimal script that shows this behaviour ? That will help people check what is going on.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            C.J. Mejias
            wrote last edited by
            #5

            This code, show a window just with the close button, but the botton appear inactive:

            import sys
            from PySide6.QtCore import Qt
            from PySide6.QtWidgets import QApplication, QMainWindow

            class MainWindow(QMainWindow):
            def init(self):
            super().init()
            self.setWindowTitle("Frameless Window Example")
            self.resize(400, 200)

                # Set the window flag to remove the default system title bar and border
                #self.setWindowFlags(Qt.WindowType.FramelessWindowHint)  ~Qt.WindowMinMaxButtonsHint
                self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)
            

            if name == "main":
            app = QApplication(sys.argv)
            window = MainWindow()
            window.show()
            sys.exit(app.exec())

            1 Reply Last reply
            0
            • C Offline
              C Offline
              C.J. Mejias
              wrote last edited by
              #6

              Hey Group,
              This statement
              self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)
              Works fine in pyside 6.9 and python 3.10

              BUT not in pyside 6.10 and python 3.14

              After read: https://doc.qt.io/qt-6/qtwidgets-widgets-windowflags-example.html

              We changed the statement for:
              self.setWindowFlags( flags = Qt.Window | Qt.WindowCloseButtonHint)

              Problem resolved

              The bad news is that we need change all the application, anyway we need migrate to python 3.14

              SGaist, thank you for your time....

              JonBJ 1 Reply Last reply
              0
              • C C.J. Mejias

                Hey Group,
                This statement
                self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)
                Works fine in pyside 6.9 and python 3.10

                BUT not in pyside 6.10 and python 3.14

                After read: https://doc.qt.io/qt-6/qtwidgets-widgets-windowflags-example.html

                We changed the statement for:
                self.setWindowFlags( flags = Qt.Window | Qt.WindowCloseButtonHint)

                Problem resolved

                The bad news is that we need change all the application, anyway we need migrate to python 3.14

                SGaist, thank you for your time....

                JonBJ Online
                JonBJ Online
                JonB
                wrote last edited by JonB
                #7

                @C.J.-Mejias
                Given that you say:

                self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)  # does not work
                self.setWindowFlags( flags = Qt.Window | Qt.WindowCloseButtonHint)  # does work
                

                I would check before executing the first statement what self.windowFlags() had in it --- did it include Qt.Window and Qt.WindowCloseButtonHint to start with? And for that matter also what it returns after that statement, so that we know what the flags have actually been changed to. All it should be doing is switching off whatever is in Qt.WindowMinMaxButtonsHint, which should not be anything to do with Qt.Window or Qt.WindowCloseButtonHint. You have not yet discovered whether this change in behaviour is to do with Qt, PySide or Python.

                1 Reply Last reply
                2

                • Login

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