python - Add multiple docked widgets -


i try add multiple tabified qdockwidgets somehow can have docked @ same time.

mwe code:

from pyqt5.qtwidgets import * pyqt5.qtcore import *  class dockwindow(qdockwidget):     def __init__(self, parent, name):         super().__init__(parent)          parent.adddockwidget(qt.topdockwidgetarea, self)         self.setwindowtitle(name)         child = parent.findchildren(dockwindow)          if len(child) > 1:             parent.tabifydockwidget(self, child[0])             self.raise_()   app = qapplication(sys.argv) main = qmainwindow()  in range(10):     dockwindow(main, str(i))   main.show() sys.exit(qapp.exec_()) 

enter image description here

according docs:

void qmainwindow::tabifydockwidget(qdockwidget * first, qdockwidget * second)

moves second dock widget on top of first dock widget, creating tabbed docked area in main window.

from concluded in first parameter must initial qdockwidget, if child[0], second new qdockwidget, in case self. problem solved changing:

parent.tabifydockwidget(self, child[0]) 

to:

parent.tabifydockwidget(child[0], self) 

screenshot:

enter image description here


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -