Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With QT, is there a way to specify different UI layouts for different UI styles?

I've got a cross platform Qt app, and no matter how I tweak the UI, it always looks good on some platforms and bad on others, due to the differences between UI styles.

For example, margins seem to be universally set, even while the underlying elements shift in size dramatically from one platform to another.

What's the recommended way to handle this?

like image 920
Nantucket Avatar asked Oct 14 '22 02:10

Nantucket


1 Answers

Probably the safest way is to have the most basic UI to start with. Personally I use the qt's css type of styling. Also make sure when you subclass your widgets, you properly override event methods (i.e. resizeEvent(...), hand off parameters to a super class when appropriate. etc) Following basic recommendations from the Qt Docs should do it. Another note on layouts, make sure you are using:

enum QSizePolicy::Policy

appropriately and your layouts flow well when resized etc, instead of using fixed positions...

like image 152
bgs Avatar answered Nov 15 '22 10:11

bgs