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 do I make my QMainWindow's contents dynamically resize after floating a QDockWidget?
Qt 6.11 is out! See what's new in the release blog

How do I make my QMainWindow's contents dynamically resize after floating a QDockWidget?

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 3 Posters 214 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.
  • F Offline
    F Offline
    FatesealMagic
    wrote last edited by FatesealMagic
    #1

    I managed to boil the problem down to a single example:

    from PySide6.QtCore import Qt
    from PySide6.QtWidgets import QApplication, QDockWidget, QLabel, QMainWindow, QPushButton
    
    class MainWindow (QMainWindow):
    	
    	def __init__ (self):
    		super().__init__()
    		btn = QPushButton('Create Dock')
    		btn.clicked.connect(self.evt_clicked)
    		self.setCentralWidget(btn)
    
    	def evt_clicked (self) -> None:
    		dock = QDockWidget('Dock', self)
    		dock.setWidget(QLabel('Label'))
    		self.addDockWidget(Qt.BottomDockWidgetArea, dock)
    
    if __name__ == '__main__':
    	app = QApplication()
    	window = MainWindow()
    	window.show()
    	app.exec()
    

    I clicked the button a few times to create a few docked widgets, then dragged one out of the QMainWindow area and onto my desktop to float it. After I did this, NONE of the QMainWindow's contents, the button and all remaining docks included, will resize when I resize the window itself. Taking any floating dock and re-attaching it to the window fixes this problem.

    I made a short video that showcases the problem: https://youtu.be/Gfpu0l4zN5M

    Does anyone else know how to fix this?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      friedemannkleint
      wrote last edited by
      #2

      This is a known bug in dock widgets which should be fixed in 6.11.2 AFAIK.

      1 Reply Last reply
      1
      • F Offline
        F Offline
        FatesealMagic
        wrote last edited by FatesealMagic
        #3

        I tried this code on a different machine with Ot/PySide6 6.11.0 and it worked as expected. Thank you!

        EDIT: For completeness, apparently this issue only impacts very specific QT versions: https://stackoverflow.com/questions/79999518/how-do-i-make-my-qmainwindows-contents-dynamically-resize-after-floating-a-qdoc/79999535#79999535

        JKSHJ 1 Reply Last reply
        1
        • F FatesealMagic

          I tried this code on a different machine with Ot/PySide6 6.11.0 and it worked as expected. Thank you!

          EDIT: For completeness, apparently this issue only impacts very specific QT versions: https://stackoverflow.com/questions/79999518/how-do-i-make-my-qmainwindows-contents-dynamically-resize-after-floating-a-qdoc/79999535#79999535

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote last edited by
          #4

          @FatesealMagic said in How do I make my QMainWindow's contents dynamically resize after floating a QDockWidget?:

          I tried this code on a different machine with Ot/PySide6 6.11.0 and it worked as expected. Thank you!

          EDIT: For completeness, apparently this issue only impacts very specific QT versions: https://stackoverflow.com/questions/79999518/how-do-i-make-my-qmainwindows-contents-dynamically-resize-after-floating-a-qdoc/79999535#79999535

          Indeed: https://qt-project.atlassian.net/browse/QTBUG-147209

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          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