Reputation: 61
I'm deploying my application with Qt Framework. The behaviour of layout is equal in Windows and Linux; and if I resize the windows the layout adapts. This doesn't happen in Mac OS. To develop for Mac, I'm using a virtual machine (the resolution is 1024x768), but, when I try to start my bundle in a "true" Mac (resolution's biggest) the result is terrible!
I put some pictures:
MAC - virtual machine (1024x768) - First tab (OK)
MAC - virtual machine (1024x768) - Second tab (Not OK)**
**The second tab "Rubrica Contatti" is designed like the first tab "Ricettario". In designer the second tab seems ok, at runtime no!
I have tried to create a new project for test. I've set the Central Widget with Form Layout. I've created 2 Widgets that contain these items (each widget has a Grid Layout):
All these three items are clustered in vertical layout. I put the left widget in QSizePolicy::Minimum and the right one in QSizePolicy::Preferred. In Qt Designer the left panel is smaller and the right one is horizontally enlarged. When I start the app, both widget have the same width and are in the center of the window.
Note:
When I open any project, I get this text in "General Messages" .
Warnings while parsing QML type information of /Users/denny/Qt/5.5/clang_64/qml:
<dump of /Users/denny/Qt/5.5/clang_64/qml>:1:24: Reading only version 1.1 parts.
<dump of /Users/denny/Qt/5.5/clang_64/qml>:10:5: Expected only Component and ModuleApi objects definitions.
Could it be the cause?
Upvotes: 2
Views: 1331
Reputation: 21
It happens because, different styles use different expanding policies. For example the QFormLayout deals with enum QFormLayout::FieldGrowthPolicy.
QFormLayout::FieldsStayAtSizeHint
- This is the default for QMacStyle.
QFormLayout::AllNonFixedFieldsGrow
- This is the default policy for most styles.
QFormLayout::ExpandingFieldsGrow
- This is the default policy for Plastique.
Upvotes: 1
Reputation: 61
The problem remains, but it solved so (for now)...
QApplication::setStyle("fusion");
My app won't use Mac Themes, but it will use Fusion Theme...
Note:
The graphic is uglier, but it works!
Upvotes: 3
Reputation: 22910
QSizePolicy::Minimum
. It means this widget can be larger but there is no point expanding it.QSizePolicy::Preferred
. It means if there is space to grow further use it.Put the left panel widget in a single widget, the right panel widgets in another widget, and use a form layout. The form layout usually set the right size policies for left and right.
Upvotes: 0