[Interest] Widget cross-platform (minimum) size constraint problem.

Joseph Crowell joseph.w.crowell at gmail.com
Wed Jan 2 08:08:55 CET 2013


Your issue is that while your size code might be the same between 
platforms, fonts and therefore font sizes are not. The fonts are usually 
larger on linux. This of course results in the necessity for a larger 
minimum value for your window size. The most obvious fix is to set the 
minimum window size to the size for linux and not Windows.

On 01/02/2013 06:13 AM, Goblin Coding wrote:
>
> Hi All,
>
> First of all, I have had a look at the documentation, I've tried 
> various combinations of setting minimum sizes, different size 
> policies, calling updateGeometry() and adjustSize(), I've searched the 
> forum for "qwidget minimum size" and others, I've asked Google...and 
> I'm still stuck.
>
> *Background*
> I have a widget deriving from QScrollArea. This widget is populated 
> with a bunch of QGroupBox'es in a horizontal layout (the main layout 
> for the widget). Each QGroupBox contains buttons and/or other standard 
> Qt widgets and all of them have layouts assigned to them and their 
> content.
>
> *The problem*
> On Windows, I manage to ensure that the widget is created with the 
> minimum size required to display the content WITHOUT having to show 
> any scroll bars by setting the minimumSize property (using QtCreator 
> and designer) and setting both the horizontal and vertical size 
> policies to "Fixed". This works just fine.
>
> However, compiling the same code on Ubuntu (12.04 LTS), the widget is 
> displayed with the horizontal scroll bar showing at start-up. Now, I 
> can obviously sort that out (for Ubuntu) by playing around with the 
> minimum size settings, but that kind of defeats the point of "code 
> once, deploy everywhere".
>
> *The question*
> Is there a way to ensure that what I see in designer is what I get? In 
> case this is not clear: is there a way to ensure that the widget, when 
> set on a parent widget or window, will look /exactly/ like it does 
> when viewed in designer?
>
> *Qt details:*
>
> QtCreator 2.4.1 based on Qt 4.7.4 (32 bit)
>
> Thanks for your help!
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130102/adbae556/attachment.html>


More information about the Interest mailing list