[PyQt] Some problems with styleSheets in QT4.3.1 and PyQt4.3

David Boddie david at boddie.org.uk
Tue Aug 21 15:36:53 BST 2007


On Sunday 19 August 2007 23:56, you wrote:

> So, with QT4.3.1 and pyqt4.3  the tabwidget uses the stackedwidget
> background pixmap (as i clearly demostrate on the screenshots....)
> 
> This does not happen with qt4.3 nd pyqt4.3

OK. The problem is that the bug which prevented QStackedWidget from being
styled correctly was fixed in Qt 4.3.1. Previously, you had to set the
frame style to make it work.

Unfortunately, QTabWidget itself contains an internal QStackedWidget, and
that is now styled as well. The trick is to make sure that this internal
QStackedWidget has its own background. You can turn it off by adding this
to the style sheet for each QTabWidget instance:

  QTabWidget QStackedWidget { background: none }

I'm told that future Qt releases will use something like this in the default
widget style sheet, so this workaround will only be necessary for Qt 4.3.1.
Still, it shouldn't cause any side effects if it's applied twice.

David


More information about the PyQt mailing list