如何在 pyqt/pyside 中将主窗口的颜色更改为特定颜色?

How to change mainwindow's color to a specific color in pyqt/pyside?

我想在我的应用程序中使用浅蓝色,恰好是 html 颜色代码中的 #99ccff。在我的申请中,我有:

palette = QtGui.QPalette()
palette.setColor(QtGui.QPalette.Background, QtCore.Qt.blue)
self.setPalette(palette)

虽然把颜色改成了蓝色,但不是我想要的那种蓝色。

使用:

palette.setColor(QtGui.QPalette.Background, QColor("#99ccff"))