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
Qt Code:
  1. #ifdef Q_OS_LINUX
  2. QApplication::setStyle("Clearlooks");
  3. #endif
  4. #ifdef Q_OS_MACX
  5. QApplication::setStyle("Clearlooks");
  6. #endif
  7. #ifdef Q_OS_WIN32
  8. QApplication::setStyle("Clearlooks");
  9. #endif
  10.  
  11. 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?