| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 5 | |
Hi all, Is there anyone who knows that how Qt4.4 implements different UI look & feels on different OS? I guess Qt4.4 emulates all native UI elements of each OS by using Qt style sheets. But, is it possible that Qt4.4 uses the native UI elements directly? For example, on MacOS X, if the user chooses to use QMacStyle, all Qt widgets will be the native controls provided by MacOS X. If and Only if the Qt window style chosen by user is different with the host OS, Qt will use emulation to show UI similar to the host OS's native UI. Would you kindly give any clue? Best, - Hua
FQTerm wrote: > Hi all, > Is there anyone who knows that how Qt4.4 implements different UI > look & feels on different OS? > > I guess Qt4.4 emulates all native UI elements of each OS by using > Qt style sheets. But, is it possible that Qt4.4 uses the native > UI elements directly? Apart from KDE where Qt truly is native, look and feels are generally implemented using platform dependent styles to mimic the appearance of native widgets. The exception is for standard system dialogs such as file and printer dialogs where Qt uses native versions when available. On platforms such as Windows and Mac, the style uses the native theme engine, meaning they will look just like their native counterparts. For developers this means we can provide a more flexible API and for users the difference should not matter. It is also worth pointing out that you can usually also embed native widgets inside your Qt application. -- [ signature omitted ]
and what about order of stylesheets in ui (or loading a stylesheet file) and native or no native style sheet? I mean, if I want tu use another style than native one as base style for the application and customize some widgets with stylesheet. on windowsXP for example, I want a motif style as base and use stylesheet in UI. is Qt will apply motif style (setstylesheet) and, then modify widgets when stylesheet is define for some of them? VL. PS: another subject .. tell me if I'm wrong but for print and file dialogs, I may use Qt ones (no native one) if I want to translate them. Option::DontUseNativeDialog. SO, I may manage style for this dialogs in this case. Jens Bache-Wiig a écrit : > FQTerm wrote: >> Hi all, >> Is there anyone who knows that how Qt4.4 implements different UI >> look & feels on different OS? >> >> I guess Qt4.4 emulates all native UI elements of each OS by using >> Qt style sheets. But, is it possible that Qt4.4 uses the native >> UI elements directly? > > Apart from KDE where Qt truly is native, look and feels > are generally implemented using platform dependent styles to mimic the > appearance of native widgets. The exception is for standard system > dialogs such as file and printer dialogs where Qt uses native versions > when available. > > On platforms such as Windows and Mac, the style uses the native theme > engine, meaning they will look just like their native counterparts. > For developers this means we can provide a more flexible API and for > users the difference should not matter. It is also worth pointing out > that you can usually also embed native widgets inside your Qt > application. > -- [ signature omitted ]
> I want a motif style as base and use > stylesheet in UI. > is Qt will apply motif style (setstylesheet) and, then modify widgets > when stylesheet is define for some of them? This should work fine. Just set QMotifStyle as the application style on startup and customize the individual widgets using style sheets. > PS: another subject .. > tell me if I'm wrong but for print and file dialogs, I may use Qt ones > (no native one) if I want to translate them. > Option::DontUseNativeDialog. > SO, I may manage style for this dialogs in this case. Correct. By default native dialogs are used. The flag is provided so that you can completely customize the dialogs using translations, style sheets or custom widgets. -- [ signature omitted ]
On Thu, Apr 24, 2008 at 6:26 PM, Jens Bache-Wiig <jbache@xxxxxxxxxxxxx> wrote: > FQTerm wrote: > >> Hi all, >> Is there anyone who knows that how Qt4.4 implements different UI >> look & feels on different OS? >> >> I guess Qt4.4 emulates all native UI elements of each OS by using >> Qt style sheets. But, is it possible that Qt4.4 uses the native >> UI elements directly? >> > > Apart from KDE where Qt truly is native, look and feels > are generally implemented using platform dependent styles to mimic the > appearance of native widgets. The exception is for standard system dialogs > such as file and printer dialogs where Qt uses native versions when > available. > > On platforms such as Windows and Mac, the style uses the native theme > engine, meaning they will look just like their native counterparts. Thank you for your explanation :) Here what do you mean by "the native theme engine"? You mean the OS (Windows & Mac) provides some API's to help Qt mimic the appearance of native widgets, am I right? > For developers this means we can provide a more flexible API and for users > the difference should not matter. It is also worth pointing out that you can > usually also embed native widgets inside your Qt application. > > -- > Jens Bache-Wiig - jbache at trolltech.com > Trolltech AS - Sandakerveien 116, P.O. Box 4332 Nydalen, 0402 Oslo, Norway >
This is correct. Microsoft and Apple both provide a theming API that enables you to draw any widgets such as a push button using the current system theme. This is exactly the same API that the native widgets use to paint themselves internally. Note that the Windows theming API was introduced with XP. On older Windows systems there was no mechanism to change the current style apart from changing system palettes. > Thank you for your explanation :) Here what do you mean by "the native > theme engine"? You mean the OS (Windows & Mac) provides some API's to > help Qt mimic the appearance of native widgets, am I right? > > > For developers this means we can provide a more flexible API and for > users the difference should not matter. It is also worth pointing > out that you can usually also embed native widgets inside your Qt > application. -- [ signature omitted ]
On Thursday 24 April 2008 15:40:01 Jens Bache-Wiig wrote: > This is correct. Microsoft and Apple both provide a theming API that > enables you to draw any widgets such as a push button using the current > system theme. This is exactly the same API that the native widgets use > to paint themselves internally. Note that the Windows theming API was > introduced with XP. On older Windows systems there was no mechanism to > change the current style apart from changing system palettes. Complementing Jens: There are three platform-specific styles in Qt 4.3: QMacStyle QWindowsXPStyle QWindowsVistaStyle Qt 4.4 adds the QWindowsMobileStyle and QWindowsCEStyle styles. Those styles are available only on those platforms. They use the native API to draw the widgets. So your application should look *exactly* like an application drawn using that API, not an imitation thereof (poor one or not). Note, however, on the use of stylesheets. The stylesheet code will attempt to use the style you chose if it can. If it can't, then it'll switch to a Qt-drawn style, so your application may look entirely different depending on what you do with stylesheets. The inverse happens on KDE: the Qt style (whichever is used) is considered the native style. The other applications not using Qt are the ones that will be considered "alien". -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
Awesome! Thank you very much! On Thu, Apr 24, 2008 at 10:14 PM, Thiago Macieira < thiago.macieira@xxxxxxxxxxxxx> wrote: > On Thursday 24 April 2008 15:40:01 Jens Bache-Wiig wrote: > > This is correct. Microsoft and Apple both provide a theming API that > > enables you to draw any widgets such as a push button using the current > > system theme. This is exactly the same API that the native widgets use > > to paint themselves internally. Note that the Windows theming API was > > introduced with XP. On older Windows systems there was no mechanism to > > change the current style apart from changing system palettes. > > Complementing Jens: > > There are three platform-specific styles in Qt 4.3: > QMacStyle > QWindowsXPStyle > QWindowsVistaStyle > Qt 4.4 adds the QWindowsMobileStyle and QWindowsCEStyle styles. > > Those styles are available only on those platforms. They use the native API > to > draw the widgets. So your application should look *exactly* like an > application drawn using that API, not an imitation thereof (poor one or > not). > > Note, however, on the use of stylesheets. The stylesheet code will attempt > to > use the style you chose if it can. If it can't, then it'll switch to a > Qt-drawn style, so your application may look entirely different depending > on > what you do with stylesheets. > > The inverse happens on KDE: the Qt style (whichever is used) is considered > the > native style. The other applications not using Qt are the ones that will be > considered "alien". > > -- > Thiago José Macieira - thiago.macieira AT trolltech.com > Trolltech ASA - Sandakerveien 116, NO-0402 Oslo, Norway >
On 24-Apr-08, at 8:14 AM, Thiago Macieira wrote: > On Thursday 24 April 2008 15:40:01 Jens Bache-Wiig wrote: >> This is correct. Microsoft and Apple both provide a theming API that >> enables you to draw any widgets such as a push button using the >> current >> system theme. This is exactly the same API that the native widgets >> use >> to paint themselves internally. Note that the Windows theming API was >> introduced with XP. On older Windows systems there was no mechanism >> to >> change the current style apart from changing system palettes. > > Complementing Jens: > > There are three platform-specific styles in Qt 4.3: > QMacStyle > QWindowsXPStyle > QWindowsVistaStyle > Qt 4.4 adds the QWindowsMobileStyle and QWindowsCEStyle styles. > > Those styles are available only on those platforms. They use the > native API to > draw the widgets. So your application should look *exactly* like an > application drawn using that API, not an imitation thereof (poor one > or not). > > Note, however, on the use of stylesheets. The stylesheet code will > attempt to > use the style you chose if it can. If it can't, then it'll switch to a > Qt-drawn style, so your application may look entirely different > depending on > what you do with stylesheets. Isn't there a caveat to this right now in that the QMacStyle doesn't allow the use of style sheets? I thought I read that in the docs. Or has this restriction been lifted? -- [ signature omitted ]
On Thursday 24 April 2008 17:45:11 Brad Pepers wrote: > Isn't there a caveat to this right now in that the QMacStyle doesn't > allow the use of style sheets? I thought I read that in the docs. Or > has this restriction been lifted? Yes. It falls into what I said about the inability of a given style to cope with the stylesheets. The threshold varies from style to style. -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
> > On Thursday 24 April 2008 17:45:11 Brad Pepers wrote: > > Isn't there a caveat to this right now in that the QMacStyle doesn't > > allow the use of style sheets? I thought I read that in the docs. Or > > has this restriction been lifted? > > On Thu 4/24/2008 10:51 AM Thiago Macieira wrote: > Yes. It falls into what I said about the inability of a given style to > cope > with the stylesheets. The threshold varies from style to style. Ok Thiago, but does your "Yes" mean "that the QMacStyle [still] doesn't allow the use of style sheets" or does your "Yes" mean "this restriction been lifted"? I am guessing that you are confirming that the Mac style still does not allow for style sheets. :( This is very important to know since I use style sheets extensively in our application. Most of the style sheets are added at the widget level in Designer. Therefore, I will need to check to see if the current OS is Mac (#ifdef Q_WS_MAC) and somehow suppress the style sheets when running on Mac *for every widget* that contains a style sheet so that it appears natively rather than styled. Correct? > > -- > Thiago José Macieira - thiago.macieira AT trolltech.com > Trolltech ASA - Sandakerveien 116, NO-0402 Oslo, Norway -- [ signature omitted ]
Michael Booker wrote: > Designer. Therefore, I will need to check to see if the > current OS is Mac > (#ifdef Q_WS_MAC) and somehow suppress the style sheets when > running on Mac > *for every widget* that contains a style sheet so that it > appears natively > rather than styled. Correct? I'm not developing on Mac, so i might be wrong, but i think the MacStyle just ignores any style sheets, it doesn't fall back to non-native widgets. So nothing you need to do. Cheers, Peter -- [ signature omitted ]
On Thu, Apr 24, 2008 at 2:03 PM, Peter Prade <prade@xxxxxxxxxxx> wrote: > Michael Booker wrote: > > Designer. Therefore, I will need to check to see if the > > current OS is Mac > > (#ifdef Q_WS_MAC) and somehow suppress the style sheets when > > running on Mac > > *for every widget* that contains a style sheet so that it > > appears natively > > rather than styled. Correct? > > I'm not developing on Mac, so i might be wrong, but i think the MacStyle > just ignores any style sheets, it doesn't fall back to non-native > widgets. So nothing you need to do. The Mac style supports style sheets partially - for example, label foreground and background colors can be set, pushbutton foreground color can be set, but pushbutton background cannot. Keeping stylesheets when running on OS X shouldn't cause any failures, but it could lead to odd appearances depending on exactly which style elements are being set. -- [ signature omitted ]