PDA

View Full Version : Custom Style



Dusdan
1st June 2006, 13:43
Hello everybody,

I wrote a custom style for my application, wrapped it within a plugin and put it in $QTDIR/plugins/styles.
My applications are able to use, but designer is not, and I'm not able to preview forms with my style. Even qtconfig doesn't see it.

What should I do to make designer aware of my style?

jacek
1st June 2006, 14:04
Is QStyleFactory aware of your style?

Dusdan
1st June 2006, 14:19
Is QStyleFactory aware of your style?I don´t think so, I thought it automatically parsed the folder like other apps. how can I make it aware?

jacek
1st June 2006, 14:24
how can I make it aware?
It should should find that plugin all by itself, but if QStyleFactory doesn't know it, then Qt Designer won't know it either. Write a short program that creates QApplication instance and checks QStyleFactory::keys().

What did you pass as the first parameter of the Q_EXPORT_PLUGIN2() macro? Did you compile your plugin in release mode? What is the name of the file with that plugin?

Dusdan
1st June 2006, 14:57
It should should find that plugin all by itself, but if QStyleFactory doesn't know it, then Qt Designer won't know it either. Write a short program that creates QApplication instance and checks QStyleFactory::keys().

What did you pass as the first parameter of the Q_EXPORT_PLUGIN2() macro? Did you compile your plugin in release mode? What is the name of the file with that plugin?it was compiled in debug mode, now it works, thank you.

I have another problem: when I use preview from the designer it doesn´t call the polish functions. since I implemented only those functions (just wanted to change colors and fonts) nothing changes in the previewed window.

jacek
1st June 2006, 15:25
when I use preview from the designer it doesn´t call the polish functions.
How did you declare those methods? Maybe you have just implemented different methods (from compiler's point of view)? Make sure that they aren't marked as const.

Dusdan
1st June 2006, 15:35
How did you declare those methods? Maybe you have just implemented different methods (from compiler's point of view)? Make sure that they aren't marked as const.no, they aren´t const. but now it comes to my mind that it can call polish(QApplication*) because there isn any application in the preview: is it right? so there´s no way to make the windows behave exactly as they will in a stand-alone application.

jacek
1st June 2006, 16:43
is it right? so there´s no way to make the windows behave exactly as they will in a stand-alone application.
I'm not sure, I haven't played with QStyle yet, but Qt Designer sets the new style only for the form and its children, not the QApplication instance.

Brandybuck
1st September 2006, 22:50
I know I'm stepping in late with this question, but I ran across the same thing recently. Make sure your plugin doesn't have any external dependencies other (than Qt). If the style plugin links to a custom widget, then Designer can't use it. Your application can, because it has already loaded the object/library with that widget, but designer doesn't know anything about it.