PDA

View Full Version : Design help please



munna
12th October 2006, 15:29
Hi,

I have an application which has lots of input boxes whose font size and font family can be changed by the user in the preferences window.

I have a class called Preferences where I store this information by reading it from the ini file using QSettings.

The path to the input boxes is

MainWindow->Splitter->ScrollArea->Widget->Input Box

How can I pass the font information from preferences to the input boxes?

Currently, I have a singleton class called Preferences and I call Preferences::Instance() whereever I need in my program.

I doubt if this is a nice way.

Can someone tell me if there is a better way ?

Thanks a lot

high_flyer
12th October 2006, 23:50
Just returned from DevDays (was GREAT!!:cool: - I'll post inpressions later) and they showed how to use tyle sheets.
With just few lines of code, you can influence the whole look and feel of our widget, on various scopes (specific object, class, hirarchy etc...) .
http://doc.trolltech.com/4.2/qt4-2-intro.html#widget-style-sheets
This is very powerfull, but not yet fully mature.
Not all widgets are supported, and there are still some things to improrve, but man, it really rocks!
Its exactly what you want to do here, but all done for you by Qt - you only need to supply the values for the various style properties.
Another way is to implement a proxy style.