def _initWidgets(self): """Create widgets""" layout = qt.QBoxLayout(qt.QBoxLayout.LeftToRight) layout.addWidget(self._initMaskGroupBox()) layout.addWidget(self._initDrawGroupBox()) layout.addWidget(self._initThresholdGroupBox()) layout.addStretch(1) self.setLayout(layout)
def test(self): """Test update of layout direction according to dock area""" # Create a widget with a QBoxLayout layout = qt.QBoxLayout(qt.QBoxLayout.LeftToRight) layout.addWidget(qt.QLabel('First')) layout.addWidget(qt.QLabel('Second')) widget = qt.QWidget() widget.setLayout(layout) # Add it to a BoxLayoutDockWidget dock = BoxLayoutDockWidget() dock.setWidget(widget) self.window.addDockWidget(qt.Qt.BottomDockWidgetArea, dock) self.qapp.processEvents() self.assertEqual(layout.direction(), qt.QBoxLayout.LeftToRight) self.window.addDockWidget(qt.Qt.LeftDockWidgetArea, dock) self.qapp.processEvents() self.assertEqual(layout.direction(), qt.QBoxLayout.TopToBottom)