PDA

View Full Version : Customization of QGraphicsItem based applications.



rishiraj
27th August 2009, 12:56
Hi everyone,
It's been a while since I worked on Qt and honestly, I have almost forgotten whatever little I knew :o
A friend asked me this question and since I have no clue about it,so, I thought I would raise the question here and hope you guys will be able to give some suggestions.

His question was 'How do we customise the look and feel (font colour etc)of QGraphicsItem based applications without modifying the application code'?
He also said that Qstyle based customisation is available for QWidget based applications to change the look and feel without modifying the code.But,QStyle won't work for QGraphicsItem based applications.

So,is there any way to change the font,background colour etc of a QGraphicsItem based application without modifying the code?

Thanks in advance for any advice.

zgulser
28th August 2009, 09:37
Hi

As far as I know, there is no way to do this which makes much more sense than if there was.

rishiraj
28th August 2009, 13:05
Hi,
thanks for the reply.
I read the tolltech docs on QStyle yesterday and found this-
"The Qt Plugin system makes it possible to create styles as plugins. Styles created as plugins are loaded as shared objects at runtime by Qt itself.
Compile your plugin and put it into Qt's plugins/styles directory. We now have a pluggable style that Qt can load automatically. To use your new style with existing applications, simply start the application with the following argument:

./myapplication -style custom.

The application will use the look and feel from the custom style you implemented."

I guess that's what my friend meant when he talked about using Qstyle on QWidgets( to make changes in colour etc )without any changes being made in the actual application's code.Is it possible to implement something similar for QGraphicsItem based applications?Or,any other way it might be possible?

Thanks for any advice.

victor.fernandez
28th August 2009, 14:45
QStyle paint widgets with the look they want. Think of Windows, Oxygen in KDE or Mac OS X. They have different looks because there are different QStyles for them. But that applies to the look of the widgets, not their contents. A QStyle has no control over what is painted INSIDE of a QGraphicsView.