Orange Forum • View topic - How to make a QWidget inside mainArea expandable?

How to make a QWidget inside mainArea expandable?

A place to ask questions about methods in Orange and how they are used and other general support.

How to make a QWidget inside mainArea expandable?

Postby whoeverest » Sat Jul 28, 2012 23:05

My problem is this: I can't make a widget inside the widget's mainArea expand to the size of it's parent. Here's the relevant part of my code :

Code: Select all
class OWImgWidget(OWWidget):

    def __init__(self, *args, **kwargs):
       
        self.resize(600, 400)
        thumbnails = OWGUI.QListView(self.mainArea)
        thumbnails.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)


thumbnails is a QListView that I use to display thumbnails. When it's initialized, it gets a size of "PyQt4.QtCore.QSize(256, 192)" as returned by "thumbnails.hintSize()". I succeeded in manually resizing "thumbnails" with "setGeometry()" function, but that's just wrong.

So my question is: how do I make thumbnails automatically resizable? Thanks!

Re: How to make a QWidget inside mainArea expandable?

Postby Ales » Mon Jul 30, 2012 10:46

You have to add the thumbnails widget to parent widget's layout.

Code: Select all
self.mainArea.layout().addWidget(thumbnails)



Return to Questions & Support



cron