QScrollArea in a single direction, my approach feels too hacky

445 views
Skip to first unread message

Jay Goodman

unread,
Nov 8, 2012, 9:13:35 PM11/8/12
to python_in...@googlegroups.com
I feel like I am missing the obvious here.  I set up a QScrollArea, but I wanted the widget to only extend in a single direction.  I had this widget inside a splitter, so my solution was to overload the ResizeEvent of the window, and connect the splitter moved event to a method that would set the width of the Widget in the scroll area.  This works, but it just seems hacky?  Has anyone dabbled in this area and gone with a different approach?
thanks

Justin Israel

unread,
Nov 8, 2012, 9:28:43 PM11/8/12
to python_in...@googlegroups.com, python_in...@googlegroups.com
You want the scroll widget to only grow in width, or its content widget? Either way, did you try just setting a size policy on it with the vertical set to fixed? Or simply setting a fixed height value?
Can you show a code sample if I am off track?


On Nov 8, 2012, at 6:13 PM, Jay Goodman <jaycg...@gmail.com> wrote:

I feel like I am missing the obvious here.  I set up a QScrollArea, but I wanted the widget to only extend in a single direction.  I had this widget inside a splitter, so my solution was to overload the ResizeEvent of the window, and connect the splitter moved event to a method that would set the width of the Widget in the scroll area.  This works, but it just seems hacky?  Has anyone dabbled in this area and gone with a different approach?
thanks

Jay Goodman

unread,
Nov 8, 2012, 9:47:05 PM11/8/12
to python_in...@googlegroups.com
It's content should only grow in one direction.  I tried the size policy, but it didn't have an affect.  Setting widgetResizable to True will resize the widget to match the ScrollArea, and then I could set the minimum width to be a larger number--that would work as well, but then you are stuck with a large size even if you widget should be empty--still it is viable solution.  Maybe the SizePolicy is having issues because of the QSplitter?
thanks for the thoughts.
Reply all
Reply to author
Forward
0 new messages