Hi Tayfun,<br><br><div class="gmail_quote">On Thu, Nov 24, 2011 at 2:26 AM, Tayfun Kayhan <span dir="ltr"><<a href="mailto:tayfun92_kayhan@yahoo.com">tayfun92_kayhan@yahoo.com</a>></span> wrote:<br><blockquote style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;" class="gmail_quote">
<div><div style="color: rgb(0, 0, 0); font-family: tahoma,new york,times,serif; font-size: 10pt; background-color: rgb(255, 255, 255);"><div>Let <i>self.win</i> be your widget, then <i>self.win.sizeHint()</i> returns the ideal or recommended size of your widget. </div>
<div><i>self.win.minimumSizeHint()</i> returns the minimum recommended size. you can set these to resize your widget.</div><div><br></div>  <div style="font-family: tahoma,"new york",times,serif; font-size: 10pt;">
 <div style="font-family: "times new roman","new york",times,serif; font-size: 12pt;"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight: bold;">From:</span></b> Tom Bennett <<a href="mailto:tom.bennett@mail.zyzhu.net" target="_blank">tom.bennett@mail.zyzhu.net</a>><br>
 <b><span style="font-weight: bold;">To:</span></b> <a href="mailto:pyqt@riverbankcomputing.com" target="_blank">pyqt@riverbankcomputing.com</a> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, November 24, 2011 9:43 AM<br>
 <b><span style="font-weight: bold;">Subject:</span></b> [PyQt] Resizing window
 to smartly fit the contents<br> </font><div><div></div><div class="h5"> <br>
<div><div>Hi,</div><div> </div><div>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. </div>

<div> </div><div>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.</div>

<div> </div><div>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.</div>

<div> </div><div>I am wondering wat can be done to achieve this.</div><div> </div><div>Thanks,</div><div>Tom</div>
</div><br></div></div>_______________________________________________<br>PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br><a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
<br> </div> </div>  </div></div></blockquote></div><div> </div><div>This does not fully solve my problem. sizeHint() and minimumSizeHint() do not take into account how many contents are in QTableView. </div><div> </div><div>
Thanks,</div><div>Tom</div><div><br> </div>