From: <cpa...@ce...> - 2016-01-20 10:03:25
|
From: cpascual <cpa...@ce...> When using a TaurusValue customized with an extra widget, the grid layout behaves in an unexpected way regarding to its rows/columns stretch (see http://sf.net/p/tauruslib/tickets/142/#f4e4/9e68). Prevent this by inserting a spacer in the extrawidget column if no extrawidget is used. --- lib/taurus/qt/qtgui/panel/taurusvalue.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/taurus/qt/qtgui/panel/taurusvalue.py b/lib/taurus/qt/qtgui/panel/taurusvalue.py index 543ba0e..83db8ec 100644 --- a/lib/taurus/qt/qtgui/panel/taurusvalue.py +++ b/lib/taurus/qt/qtgui/panel/taurusvalue.py @@ -350,7 +350,7 @@ class TaurusValue(Qt.QWidget, TaurusBaseWidget): #insert self into the 0-column pl.addWidget(self, self._row, 0) #this widget is invisible (except in design mode) - + #Create/update the subwidgets (this also inserts them in the layout) if not self._designMode: #in design mode, no subwidgets are created self.updateLabelWidget() @@ -833,7 +833,11 @@ class TaurusValue(Qt.QWidget, TaurusBaseWidget): 1, 1, -1, alignment) def addExtraWidgetToLayout(self): - if self._extraWidget is not None and self.parent() is not None: + if self._extraWidget is None: + # Adding this spacer is some voodoo magic to avoid bug #142 + # See: http://sf.net/p/tauruslib/tickets/142/ + self.parent().layout().addItem(Qt.QSpacerItem(0, 0), self._row, 5) + elif self.parent() is not None: alignment = getattr(self._extraWidget, 'layoutAlignment', Qt.Qt.AlignmentFlag(0)) self.parent().layout().addWidget(self._extraWidget, self._row, -- 2.6.4 |