I have two dock widgets in my QApplication widget. On each widget toggle view action is called.So that it hides and shows when I check and uncheck the dock widget in menu options.`
On toggle, dock widget are not taking the size which they had before being toggled.
How can I go ahead and implement this?
following the minimal code which produces the same problem.
import sys
from PySide2.QtWidgets import QMainWindow, QAction, qApp,QApplication,QDockWidget,QWidget
from PySide2.QtGui import QIcon
from PySide2.QtCore import Qt
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
menubar = self.menuBar()
fileMenu = menubar.addMenu('&Funcionalities')
dockwindow1 = QDockWidget("dock1",self)
dockwindow1.setWidget(QWidget())
fileMenu.addAction(dockwindow1.toggleViewAction())
self.setCentralWidget(dockwindow1)
dockwindow2 = QDockWidget("dock2",self)
fileMenu.addAction(dockwindow2.toggleViewAction())
self.addDockWidget(Qt.RightDockWidgetArea, dockwindow2)
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('Simple menu')
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())`