[PyQt] Palette on QInputDialog
Sebastian Elsner
sebastianelsner at freenet.de
Thu Feb 11 11:04:00 GMT 2010
Hello,
seems like palettes are not working on QInputDialogs. Please see the
script attached. Setting a palette on an QErrorMessage works fine, but not
on a InputDialog. Using PyQt 4.6.2 on Windows XP 64bit SP2 with python
2.6.4 32bit.
from PyQt4 import QtCore
from PyQt4 import QtGui
class MyDlg (QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
self.resize(100,100)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window,
brush)
self.setPalette(palette)
self.button=QtGui.QPushButton("push me!")
self.verticalLayout = QtGui.QVBoxLayout(self)
self.verticalLayout.addWidget(self.button)
self.connect(self.button,QtCore.SIGNAL("clicked()"),self.pressed)
self.inputDialog=QtGui.QInputDialog(self)
self.inputDialog.setPalette(self.palette())
self.errorMessage=QtGui.QErrorMessage(self)
self.errorMessage.setPalette(self.palette())
def pressed(self):
self.inputDialog.getText(self,"bug?","background should be yellow")
self.errorMessage.showMessage("Works here!")
if __name__=="__main__":
import sys
app=QtGui.QApplication(sys.argv)
app.setStyle("plastique")
dlg=MyDlg()
dlg.show()
sys.exit(app.exec_())
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the PyQt
mailing list