Dont serialize alpha color component as the QColor constructor cannot handle them

This commit is contained in:
Kovid Goyal 2014-04-04 17:28:29 +05:30
parent f6a6ab51c5
commit 3346f0af4f

View File

@ -84,9 +84,5 @@ class ColorButton(QPushButton):
def choose_color(self): def choose_color(self):
col = QColorDialog.getColor(QColor(self._color or Qt.white), self, _('Choose a color')) col = QColorDialog.getColor(QColor(self._color or Qt.white), self, _('Choose a color'))
if col.isValid(): if col.isValid():
r, g, b, a = col.getRgb() self.color = unicode(col.name())
if a != 255:
self.color = '#%02x%02x%02x%02x' % col.getRgb()
else:
self.color = '#%02x%02x%02x' % (r, g, b)