View Full Version : Set appropriate style for the user's platform ?
whitefurrows
20th May 2007, 18:59
Hi,
i set the application style like this:
QApplication::setStyle(QStyleFactory::create(style Name));
then i will set the most appropriate style for the user's platform or desktop environment and try that:
QApplication::setStyle(0);
but the style don't change to the the most appropriate style!
How can i do that?
Thanks in advance,
Whitefurrows
marcel
20th May 2007, 19:07
Is styleName in the list that QStyleFactory::keys returns?
As far as I know there is no need to override manually the style, because the platform style is used by default.
Anyway, you can rest assured that WinXP style won;t be set by default on another platform than Windows, or Mac style on other platform than Mac.
I say this from experience.
wysota
20th May 2007, 19:42
I'll say even more. WinXP style won't be set on systems older than WinXP :)
whitefurrows
20th May 2007, 22:17
Yes, the styleName is in the list that QStyleFactory::keys returns for example i set "plastique":
QApplication::setStyle(QStyleFactory::create("plastique"));
Yes the platform style is used by default, but my problem is, i set a style like ("plastique") and can't reset to the platform default style.
In Qt 3.3 i can do it with:
QApplication::setStyle(0);
but Qt 4.2 do nothing.
The problem is not a dependent style like "windowsxp" and "macintosh", you know what i mean?
wysota
20th May 2007, 22:19
Why not store the name of the default style before setting the new one?
whitefurrows
20th May 2007, 22:31
How can i store the default style?
wysota
20th May 2007, 23:01
QString name = QApplication::style().objectName();
whitefurrows
21st May 2007, 16:33
Thank you, i can use it, but i think that's not fine. Is no function available like this:
QApplication->setStyle(QApplication->defaultStyle());
Thank you, i can use it, but i think that's not fine. Is no function available like this:
QApplication->setStyle(QApplication->defaultStyle());
AFAIK, nothing like that exists. You can send suggestions via Task-Tracker (http://www.trolltech.com/developer/task-tracker/).
whitefurrows
22nd May 2007, 00:57
Thanks at all. I try it and send my suggestions via Task-Tracker.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.