[Qt] theming

zeljko zeljko at holobit.net
Tue Jun 12 09:23:18 CEST 2018


On 06/11/2018 05:45 PM, Mattias Gaertner via Qt wrote:
> Hi,
> 
> This has probably been asked a zillion times, but I can't find it.
> 
> How can I theme my qt4 app?
> Not all qt4 apps, just this one.
> 
> I tried "export QT_STYLE_OVERRIDE=macintosh ./project1", but that
> didn't have an effect.
> 
> I can do it with QApplication_setStyleSheet(App, at stylesheet);, but App
> is private in TQtWidgetSet. So probably I'm missing something.

Theme & QStyleSheet are two different things.
You cannot use all themes on all platforms.
eg. ./Myapp -style macintosh won't work under linux & win32,
also ./Myapp -style winvista (or -winxp) won't work under linux & mac.
There are "standard" themes inside qt:
1.windows
2.motif
3.plastique
4.cleanlooks (gtk2)
5.gtk (Qt4 uses gtk2 for this, Qt5 as of Qt-5.9.0 uses gtk3)
Also, under KDE theme for qt libs is provided by KDE as plugin.

QApplication_setStyleSheet(QCoreApplication_instance(), @MyStyleSheet) 
works fine here.

zeljko


More information about the Qt mailing list