[PyKDE] too much code generated by QtDesigner for color change

Tony Cappellini cappy2112 at gmail.com
Sun Jan 21 15:33:51 GMT 2007


I've changed the background color of the form in my project- one click of
the mouse.
QTDesigner spews out all of this code- just to change the background color.
Why so much to change only one color?

      palette = QtGui.QPalette()
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(0),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(1),
QtGui.QColor(255,0,0))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(2),
QtGui.QColor(255,127,127))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(3),
QtGui.QColor(255,63,63))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(4),
QtGui.QColor(127,0,0))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(5),
QtGui.QColor(170,0,0))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(6),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(7),
QtGui.QColor(255,255,255))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(8),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(9),
QtGui.QColor(255,255,255))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(10),
QtGui.QColor(255,0,0))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(11),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(12),
QtGui.QColor(10,36,106))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(13),
QtGui.QColor(255,255,255))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(14),
QtGui.QColor(0,0,255))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(15),
QtGui.QColor(255,0,255))
      palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(16),
QtGui.QColor(255,127,127))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(0),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(1),
QtGui.QColor(255,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(2),
QtGui.QColor(255,127,127))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(3),
QtGui.QColor(255,63,63))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(4),
QtGui.QColor(127,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(5),
QtGui.QColor(170,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(6),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(7),
QtGui.QColor(255,255,255))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(8),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(9),
QtGui.QColor(255,255,255))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(10),
QtGui.QColor(255,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(11),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(12),
QtGui.QColor(212,208,200))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(13),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(14),
QtGui.QColor(0,0,255))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(15),
QtGui.QColor(255,0,255))
      palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(16),
QtGui.QColor(255,127,127))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(0),
QtGui.QColor(127,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(1),
QtGui.QColor(255,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(2),
QtGui.QColor(255,127,127))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(3),
QtGui.QColor(255,63,63))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(4),
QtGui.QColor(127,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(5),
QtGui.QColor(170,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(6),
QtGui.QColor(127,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(7),
QtGui.QColor(255,255,255))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(8),
QtGui.QColor(127,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(9),
QtGui.QColor(255,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(10),
QtGui.QColor(255,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(11),
QtGui.QColor(0,0,0))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(12),
QtGui.QColor(10,36,106))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(13),
QtGui.QColor(255,255,255))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(14),
QtGui.QColor(0,0,255))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(15),
QtGui.QColor(255,0,255))
      palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(16),
QtGui.QColor(255,0,0))
      MainWindow.setPalette(palette)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070121/c9739844/attachment.html


More information about the PyQt mailing list