Skip to content

Commit

Permalink
FIX: resizable was resizing in all directions (qt)
Browse files Browse the repository at this point in the history
item.resizable should resize along the item's group non-layout direction, but in Qt it was resizing in all directions instead
  • Loading branch information
pberkes committed Feb 2, 2012
1 parent aa2b980 commit ce45672
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion traitsui/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Item ( ViewSubElement ):
# Additional editor traits to be set if default traits editor to be used:
editor_args = Dict

# Should the item use extra space along its Group's layout axis? If set to
# Should the item use extra space along its Group's non-layout axis? If set to
# True, the widget expands to fill any extra space that is available in the
# display. If set to True for more than one item in the same View, any extra
# space is divided between them. If set to False, the widget uses only
Expand Down
16 changes: 9 additions & 7 deletions traitsui/qt4/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,20 @@ def set_size_policy(self, direction, resizable, springy, stretch):
policy = self.control.sizePolicy()

if direction == QtGui.QBoxLayout.LeftToRight:
policy.setHorizontalStretch(stretch)
if springy:
policy.setHorizontalStretch(stretch)
policy.setHorizontalPolicy(QtGui.QSizePolicy.Expanding)
if resizable :
if resizable:
policy.setVerticalStretch(stretch)
policy.setVerticalPolicy(QtGui.QSizePolicy.Expanding)

else:
policy.setVerticalStretch(stretch)
if resizable :
policy.setHorizontalPolicy(QtGui.QSizePolicy.Expanding)
if springy :
else: # TopToBottom
if springy:
policy.setVerticalStretch(stretch)
policy.setVerticalPolicy(QtGui.QSizePolicy.Expanding)
if resizable:
policy.setHorizontalStretch(stretch)
policy.setHorizontalPolicy(QtGui.QSizePolicy.Expanding)

self.control.setSizePolicy(policy)

Expand Down

0 comments on commit ce45672

Please sign in to comment.