Hi Tayfun, On Thu, Nov 24, 2011 at 2:26 AM, Tayfun Kayhan <tayfun92_kay...@yahoo.com>wrote:
> Let *self.win* be your widget, then *self.win.sizeHint()* returns the > ideal or recommended size of your widget. > *self.win.minimumSizeHint()* returns the minimum recommended size. you > can set these to resize your widget. > > ------------------------------ > *From:* Tom Bennett <tom.benn...@mail.zyzhu.net> > *To:* pyqt@riverbankcomputing.com > *Sent:* Thursday, November 24, 2011 9:43 AM > *Subject:* [PyQt] Resizing window to smartly fit the contents > > Hi, > > I have a window that contains a composite widget that in turn contains > some basic widgets and a table view. Depending on different situations, the > table view can have a little or a lot data. > > What I want is for the window to show a reasonable default size when it > comes up. In other words, when there is a little data, don't show a huge > window; when there is a lot of data, don't show a tiny window. > > To make things more complicated, there has to be some minimum and maximum > size. For example, the window size cannot be bigger than the screen size. > But using the screen size is not exactly right, because the desktop system > occupies part of the screen. For example, on Windows, the bottom area of > the main screen is reserved for the system task bar, and should not be > covered by my window, whereas on the second screen usuallt one can occupy > the whole screen size. > > I am wondering wat can be done to achieve this. > > Thanks, > Tom > > _______________________________________________ > PyQt mailing list PyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > > This does not fully solve my problem. sizeHint() and minimumSizeHint() do not take into account how many contents are in QTableView. Thanks, Tom
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt