def openColorDialog(self): colorDialog = QtWidgets.QColorDialog() colorDialog.setOption(QtWidgets.QColorDialog.DontUseNativeDialog, True) newColor = colorDialog.getColor(self._color, self) if newColor.isValid(): self._color = newColor self.colorChanged.emit(newColor)
def mousePressEvent(self, event): if self._valueController.isEditable(): self.__backupColor = self.__color self.beginInteraction() dialog = QtWidgets.QColorDialog(self.__color, self) dialog.currentColorChanged.connect(self.__onColorChanged) dialog.accepted.connect(self.__onAccepted) dialog.rejected.connect(self.__onCanceled) dialog.setModal(True) dialog.show()