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

2013-01-02 Thread Goblin Coding
Hi Tony,

You make a valid point.  Originally the idea was to allow for scrollbars,
but since that comes with an entirely different set of issues (as soon as
the scrollbar appears, it cramps the style of the remaining
widgets...i.e. when the horizontal scrollbar is created, it actually uses
some of the available vertical space and overlaps some of the widgets in
the scroll area...I hope that makes sense).

I'll try using a standard QWidget as parent (as opposed to the QScrollArea)
and see how that pans out.

I also realise that there are no guarantees regarding the look of the Qt
widgets on different platforms.  What I actually wanted to find out is if
there was a way to design a widget in Qt Designer so that the way it looks
in Designer will be the way it is created at run-time? (i.e. if I tweak it
on Windows and run it on Windows, it should look fine on Windows...if I
subsequently go tweak it on Linux and run it on Linux, it should look fine
on Linux).  My problem is that, so far, it seems setting min values is a
hit and miss operation - tweak value, compile, run, see what it looks like,
realise it's too big/small, tweak value, compile, etc etc.

Thanks for the input!
William




On Wed, Jan 2, 2013 at 9:13 AM, Tony Rietwyk t...@rightsoft.com.au wrote:

 Hi, 

 ** **

 The short answer is NO - Qt does not guarantee that designer created
 layouts look identical on all platforms.   Especially on Mac where the
 minimum sizes are much larger due to the larger default font size and
 layout margins.   The same widget type will have different default minimum
 sizes depending on the platform and desktop style.  

 ** **

 It's not clear to me why you have put the groups in a scroll area, if you
 don't want scroll bars to be shown.   If you drag the layout into a normal
 dialog or main window, then the minimum sizes that you have set should be
 respected, and the group boxes should grow if you have allowed that.  

 ** **

 Tony.

 ** **

 ** **

 ** **

 *From:* interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:
 interest-bounces+tony=rightsoft.com...@qt-project.org] *On Behalf Of *Goblin
 Coding
 *Sent:* Wednesday, 2 January 2013 5:13 PM
 *To:* interest@qt-project.org
 *Subject:* [Interest] Widget cross-platform (minimum) size constraint
 problem.

 ** **

 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@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


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

2013-01-02 Thread Frank Hemer
On Wednesday 02 January 2013 10:46:24 Goblin Coding wrote:
 Hi Tony,
 
 You make a valid point.  Originally the idea was to allow for scrollbars,
 but since that comes with an entirely different set of issues (as soon as
 the scrollbar appears, it cramps the style of the remaining
 widgets...i.e. when the horizontal scrollbar is created, it actually uses
 some of the available vertical space and overlaps some of the widgets in
 the scroll area...I hope that makes sense).
 
 I'll try using a standard QWidget as parent (as opposed to the QScrollArea)
 and see how that pans out.
 
 I also realise that there are no guarantees regarding the look of the Qt
 widgets on different platforms.  What I actually wanted to find out is if
 there was a way to design a widget in Qt Designer so that the way it looks
 in Designer will be the way it is created at run-time? (i.e. if I tweak it
 on Windows and run it on Windows, it should look fine on Windows...if I
 subsequently go tweak it on Linux and run it on Linux, it should look fine
 on Linux).  My problem is that, so far, it seems setting min values is a
 hit and miss operation - tweak value, compile, run, see what it looks like,
 realise it's too big/small, tweak value, compile, etc etc.

What you would need is a 'getMinRequiredSize' method ...
I whish this would exist - as it would allow for choosing different layouts 
according to the available space, i.e. to create specialized layout managers. 
Currently calculating the expected size _BEFORE_ showing a widget is really 
expensive ...

Frank
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


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

2013-01-02 Thread Joseph Crowell
On 01/02/2013 12:07 PM, Frank Hemer wrote:
 On Wednesday 02 January 2013 10:46:24 Goblin Coding wrote:
 Hi Tony,

 You make a valid point.  Originally the idea was to allow for scrollbars,
 but since that comes with an entirely different set of issues (as soon as
 the scrollbar appears, it cramps the style of the remaining
 widgets...i.e. when the horizontal scrollbar is created, it actually uses
 some of the available vertical space and overlaps some of the widgets in
 the scroll area...I hope that makes sense).

 I'll try using a standard QWidget as parent (as opposed to the QScrollArea)
 and see how that pans out.

 I also realise that there are no guarantees regarding the look of the Qt
 widgets on different platforms.  What I actually wanted to find out is if
 there was a way to design a widget in Qt Designer so that the way it looks
 in Designer will be the way it is created at run-time? (i.e. if I tweak it
 on Windows and run it on Windows, it should look fine on Windows...if I
 subsequently go tweak it on Linux and run it on Linux, it should look fine
 on Linux).  My problem is that, so far, it seems setting min values is a
 hit and miss operation - tweak value, compile, run, see what it looks like,
 realise it's too big/small, tweak value, compile, etc etc.
 What you would need is a 'getMinRequiredSize' method ...
 I whish this would exist - as it would allow for choosing different layouts
 according to the available space, i.e. to create specialized layout managers.
 Currently calculating the expected size _BEFORE_ showing a widget is really
 expensive ...

+1

 Frank
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


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

2013-01-02 Thread Thiago Macieira
On quarta-feira, 2 de janeiro de 2013 10.46.24, Goblin Coding wrote:
 I also realise that there are no guarantees regarding the look of the Qt
 widgets on different platforms.  What I actually wanted to find out is if
 there was a way to design a widget in Qt Designer so that the way it looks
 in Designer will be the way it is created at run-time? (i.e. if I tweak it
 on Windows and run it on Windows, it should look fine on Windows...if I
 subsequently go tweak it on Linux and run it on Linux, it should look fine
 on Linux).  My problem is that, so far, it seems setting min values is a
 hit and miss operation - tweak value, compile, run, see what it looks like,
 realise it's too big/small, tweak value, compile, etc etc.

That still doesn't exist on Linux due to different font sizes, DPI settings and 
general widget styles varying between users.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center


signature.asc
Description: This is a digitally signed message part.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


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

2013-01-01 Thread Tony Rietwyk
Hi, 

 

The short answer is NO - Qt does not guarantee that designer created layouts
look identical on all platforms.   Especially on Mac where the minimum sizes
are much larger due to the larger default font size and layout margins.
The same widget type will have different default minimum sizes depending on
the platform and desktop style.  

 

It's not clear to me why you have put the groups in a scroll area, if you
don't want scroll bars to be shown.   If you drag the layout into a normal
dialog or main window, then the minimum sizes that you have set should be
respected, and the group boxes should grow if you have allowed that.  

 

Tony.

 

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Goblin Coding
Sent: Wednesday, 2 January 2013 5:13 PM
To: interest@qt-project.org
Subject: [Interest] Widget cross-platform (minimum) size constraint problem.

 

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@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest