Hi,

I'm trying to change the background of a QMdiSubwindow but it is not as
easy as I expected. For simplicity, in the attached example, I use a
QLabel as internal widget. When I try to change the label background
using the common chain

get palette + change palette + set palette

nothing happens (although it works when the QLabel is not the internal
widget of a QMdiSubWindow). I'm forced to use a style sheet. However
I'd prefer not to do it (stylesheets are not supported on Mac OS X, the
Qt docs says). The attached script shows the problem.

Could somebody help me with this problem?

TIA

PS: I'm using Qt 4.4.0 and PyQt 4.4.4

Vicent

-- 
Share what you know, learn what you don't.
#!/usr/bin/env python

import sys

from PyQt4.QtCore import *
from PyQt4.QtGui import *

app = QApplication(sys.argv)

#This works
label = QLabel('Hi darling!             ')
palette = label.palette()
palette.setBrush(QPalette.Active, QPalette.Window, QBrush(QColor('red')))
label.setPalette(palette)
label.show()

#This doesn't
mdi = QMdiArea()
new_label = QLabel('Hi again honey!               ')
#new_label.setStyleSheet("background-color: red")
new_palette = new_label.palette()
new_palette.setBrush(QPalette.Active, QPalette.Window, QBrush(QColor('red')))
new_label.setPalette(new_palette)
mdi.addSubWindow(new_label)
mdi.show()

app.exec_()
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to