[SOLVED] How to get the current application style name
-
Hi all,
¿How can I get the current application style name? I want to get one of texts returned by QStyleFactory::keys().
Regards
-
What about this:
@qDebug() << QApplication::style()->objectName()@
You can also check this: "QApplication::StyleSheet()":http://qt-project.org/doc/qt-4.8/qapplication.html#styleSheet-propI'm not sure if this is what You are looking for,,,
with best regards,
Robert -
Hi poorBob, thanks for your reply.
It just print: ""
Regards
-
Hi MuldeR, thanks for the replay.
It prints: P6QStyle, and I need one of the following:
("Oxygen", "Windows", "Motif", "CDE", "Plastique", "GTK+", "Cleanlooks")
Regards
-
on what operating system did you check it? I guess a linux variant...
This is what i get returned (Windows 7):
@
QApplication::style()->objectname(); //"windowsvista"
QApplication::style()->metaObject()->className(); //"QWindowsVistaStyle"
@
where
@
QStyleFactory::keys();
//("Windows", "WindowsXP", "WindowsVista", "Motif", "CDE", "Plastique", "Cleanlooks")
@ -
Hi raven-worx, thanks for your replay.
I use Linux 64 Bits, Qt 4.8.
@QApplication::style()->objectname();@
Prints: error: 'class QStyle' has no member named 'objectname'@QApplication::style()->metaObject()->className();@
Prints: QStyleSheetStyleAnd I need the name of the current Style:
(“Oxygen”, “Windows”, “Motif”, “CDE”, “Plastique”, “GTK+”, “Cleanlooks”) -
[quote author="David Villalobos" date="1385645825"]Hi MuldeR, thanks for the replay.
It prints: P6QStyle, and I need one of the following:
("Oxygen", "Windows", "Motif", "CDE", "Plastique", "GTK+", "Cleanlooks")
Regards[/quote]
Sorry, I meant:
@qDebug("%s", typeid(*QApplication::style()).name();@This gives me the following result:
@class QPlastiqueStyle@ -
[quote author="David Villalobos" date="1385646560"]
@QApplication::style()->objectname();@
Prints: error: 'class QStyle' has no member named 'objectname'
[/quote]
it's a typo mistake... should be objectName().
So you have a stylesheet style set in your application. This is your style then. What exactly do you want to do with the stylename? Why do you need it to be contained in the QStyleFactory::keys() list? -
Hi.
All your aswers help me to finf the problem.
In the startup class I have this line:
@qApp->setStyleSheet(QString::fromUtf8(styleFile.readAll()));@
This line is the problem.If commented:
@qDebug() << QApplication::style()->metaObject()->className();@
Prints: QPlastiqueStyleRegards.