[Qt-interest] Preferred method of making embedded linux application themable ?

Andre Somers andre at familiesomers.nl
Sun Jun 20 12:22:38 CEST 2010


Hi,

Op 18-6-2010 17:14, Pritam Ghanghas schreef:
> Hi
>
> Anybody interested in sharing some experience on this topic.
> And do I write bad/offending mails. I dont seem to get anyone's
> attention.
>    
Nothing wrong with your email. Not offending, rude or anything like 
that. Even re-asking after two days I don't find impatient, though 
opinions on that differ (some say: allow up to a week, but I personally 
don't read messages that old, even if I have been away from the list for 
a while.)

Op 16-6-2010 17:04, Pritam Ghanghas schreef:
> Hi
>
> What is preferred way of theming a embedded Linux application.
> As far as I have read and understood, one has to use a combination of
> custom/stock QStyle and QPalette. Then there are stylesheets as well.
> But according to docs stylesheets wont work for custom styles.
>
> Is this the right approach?
>    
It depends a bit on what you want to achieve, how far you need the 
theming to go, and if you even need your app to be "user themable" or 
something like that.
It is right that you can not mix stylesheets and custom styles, in the 
sense that a custom style does not have access to the style sheet it 
seems. That is not part of the public API. However, that does not mean 
that you can not use a custom style to style a couple of widgets, and 
style sheets to style others where you can get away with that...

There is not *right* approach. There are different ones that allow for 
different things. Style sheets are, as Scott rightly remarks, a younger 
technology. In some ways, they have replaced custom QStyles, but not in 
all. Note that styles can ignore a color or brush set using a palette, 
but the Qt defined styles will always obey the style sheets.
> And what happens when I switch the palette and/or style while
> application is running.
>    
As you will have to implement that yourself anyway, it would be easy to 
trigger a repaint. However, I *think* that will be triggered 
automatically. Try and you'll find out soon enough...

> Will all the widgets/items in my application redraw themselves
> automatically or I will have to do that manually.
> I can see a event QEvent::StyleChange. Will it be delivered to every
> widget in my application on styleChange?
>    
Not sure. I'd think so, but there seems to be no special event subclass 
for it. Would be easy to test though.
> But till now I have stayed away from created .ui files for UI design,
> that apporach didnt seem to fit my requirements.
>    
So what *are* your requirements exactly? I found that .ui files usually 
fit mine pretty well, and that I write little hand-written UI 
construction code anymore.
> I think this is a question, a lot of Qters would have faced and
> researched about.
>    
Perhaps not as many as you think... A lot of people are content that 
their applications fit the environment they run in. I hear more 
complaints on places where it differs from the standard look and feel, 
than that it is too hard to deviate from it (especially for mac.)

A new approach for styled applications in Qt is QML. If you want extreme 
styling, animated UI's, then perhaps this is what you need. I don't have 
experience with it myself yet, but I have seen some impressive demo's. 
Still, the technology is very young, so YMMV.

André




More information about the Qt-interest-old mailing list