here i found where is behaviour André is talking about documented: http://qt-project.org/doc/qt-4.8/stylesheet.html: When a style sheet is active, the QStyle returned by QWidget::style() is a wrapper "style sheet" style, not the platform-specific style. The wrapper style ensures that any active style sheet is respected and otherwise forwards the drawing operations to the underlying, platform-specific style (e.g., QWindowsXPStyle on Windows XP).
06.06.2012, 12:34, "André Somers" <an...@familiesomers.nl>: > Op 5-6-2012 20:47, "Alexander Carôt" schreef: > >> Hi all, >> >> I have a question in context with QSpinEdit: >> >> On a Mac this call successfully changes the color of the spinEdit: >> >> spin->setAutoFillBackground(true); >> spin->setPalette( *greenFgPalette ); >> >> On Win, however, this call seems to be ignored - the spinEdit remains >> white. Can anyone tell me how to make it work under Win ? >> >> Thanks in advance, >> best >> >> Alex > > Styles are free to ignore the set palette, and some styles, especially > those using native rendering like on windows, do in fact ignore the > palette. However, all styles will obey the style sheet. So, instead of > the palette, use a style sheet. > > spin->setStyleSheet("QSpinBox {background-color: rgb(0, 255, 0);}"); > > That should work on both platforms. > > André > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest