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. How to add a maximize button in dialog title bar, which is a child of another widget ?
Forum Updated to NodeBB v4.3 + New Features

How to add a maximize button in dialog title bar, which is a child of another widget ?

Scheduled Pinned Locked Moved Unsolved Qt for Python
1 Posts 1 Posters 1.4k 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.
  • L Offline
    L Offline
    liugang
    wrote on last edited by liugang
    #1

    code: (it is ok in MS windows, but no Maximize button in linux)

    import sys
    from PyQt5.QtGui import *
    from PyQt5.QtWidgets import *
    from PyQt5.QtCore import *
    
    
    class DialogDemo(QMainWindow):
        def __init__(self, parent=None):
            super(DialogDemo, self).__init__(parent)
            self.setWindowTitle('Main Window')
            self.resize(350, 300)
    
            self.btn = QPushButton(self)
            self.btn.setText('Popup Dialog')
            self.btn.move(50, 50)
            self.btn.clicked.connect(self.showdialog)
    
        def showdialog(self):
            dialog = QDialog(parent=self)
            btn = QPushButton('ok', dialog)
            btn.move(50, 50)
            dialog.setWindowTitle("Dialog")
    
            flags = dialog.windowFlags()
            flags |= Qt.CustomizeWindowHint
            flags |= Qt.WindowTitleHint
            flags |= Qt.WindowSystemMenuHint
            flags |= Qt.WindowCloseButtonHint
            flags |= Qt.WindowStaysOnTopHint
            flags |= Qt.WindowMaximizeButtonHint
            dialog.setWindowFlags(flags)
    
            dialog.showMaximized()
    
    
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        demo = DialogDemo()
        demo.show()
        sys.exit(app.exec_())
    
    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