I have an application that may run on multiple platforms - Windows, Linux, and Mac.
I am attempting to style a QToolBar in my QMainWindow that remains the same regardless of platform style. My attempts so far are to change the stylesheet option in QDesigner - which did nothing - and specifying a style in the QMainWindow constructor with
#ifdef Q_OS_LINUX
#endif
#ifdef Q_OS_MACX
#endif
#ifdef Q_OS_WIN32
#endif
qApp->setStyle("QToolBar {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #CFCFCF); }");
#ifdef Q_OS_LINUX
QApplication::setStyle("Clearlooks");
#endif
#ifdef Q_OS_MACX
QApplication::setStyle("Clearlooks");
#endif
#ifdef Q_OS_WIN32
QApplication::setStyle("Clearlooks");
#endif
qApp->setStyle("QToolBar {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #CFCFCF); }");
To copy to clipboard, switch view to plain text mode
The only problem is that the only effect is for the toolbar and separator actions to have a dark grey flat background. I can style the QToolButtion but that is the only thing on the toolbar that seems to change as one would expect.
Is there a way to set toolbars with specific stylesheet properties that are the same on all platforms? The aApp->setStyle() does not seem to do it.
What am I missing?
Bookmarks