我有一个QColor,是从QColorDialog.getColor()获得的。 我想在表单中向用户显示它。
我该怎么做?
我尝试使用QGraphicView并设置背景画笔,如下所示:
self.displayColor = QtGui.QGraphicView(self)
self.color = QtGui.QColor(category.color)
self.displayColor.setBackgroundBrush(QtGui.QBrush(self.color))
但是即使我换了背景刷,小部件还是保持白色。
我怎么能强迫它重新粉刷背景呢?
谢谢
最后,我选择创建这样的小部件:
我可以使用setColor()更改颜色
相关问题 更多 >
编程相关推荐