[SOLVED] How to get the current application style name
-
wrote on 27 Nov 2013, 16:46 last edited by
Hi all,
¿How can I get the current application style name? I want to get one of texts returned by QStyleFactory::keys().
Regards
-
wrote on 27 Nov 2013, 20:03 last edited by
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 -
wrote on 27 Nov 2013, 20:09 last edited by
Hi poorBob, thanks for your reply.
It just print: ""
Regards
-
wrote on 28 Nov 2013, 13:37 last edited by
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")
@ -
wrote on 28 Nov 2013, 13:49 last edited by
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”) -
wrote on 28 Nov 2013, 13:50 last edited by
[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? -
wrote on 28 Nov 2013, 14:03 last edited by
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.
9/10