[Qt-interest] KDE/Gnome/Mac platform standards and guidelines

Berry Octave octave at octavious.servegame.org
Tue Jun 1 04:35:43 CEST 2010


> On 06/01/2010 01:10 AM, Nikos Chantziaras wrote:
> >[...]
> >
> > So in the Gnome/KDE case, what should I do to tell which standard to
> > follow? How do I detect this at runtime in order to adapt application
> > behavior?
> 
> While digging around, I came across this:
> 
> http://doc.trolltech.com/4.6/qdialogbuttonbox.html#ButtonLayout-enum
> 
> But it's weird.  This enum defines WinLayout, GnomeLayout, KdeLayout,
> and MacLayout, but what the heck is it for?  There doesn't seem to be
> any use of it.  Neither setting it, nor (which is what I would want)
> query it.
> 
> So if I have a QDialogButtonBox in my dialog (which I do), if I would be
> able to query whether it uses GnomeLayout or KdeLayout, this would
> effectively tell me in which environment my app runs.  But there doesn't
> seem to be a way to query it.
> 
> Any help would be greatly appreciated.

Looked up into the sources, here is the line that queries a 
QDialogButtonBox::ButtonLayout (file qdialogbuttonbox.cpp @line 332).

layoutPolicy = QDialogButtonBox::ButtonLayout(q->style()-
>styleHint(QStyle::SH_DialogButtonLayout, 0, q));

So basically, all you need to do is to query the correct styleHint for your 
application current style.

Regards

Berry Octave





More information about the Qt-interest-old mailing list