コード例 #1
0
        self._color = color
        self.refresh()

        if (not self.signalsBlocked()):
            self.colorChanged.emit(color)

    def togglePopup(self):
        if (not self._colorPickerWidget.isVisible()):
            w = self.width()
            if (w < 120):
                w = 120

            self._cancelled = False
            self._colorPickerWidget.resize(w, 120)
            self._colorPickerWidget.move(
                self.mapToGlobal(QPoint(0, self.height())))
            self._colorPickerWidget.setColor(self.color())
            self._colorPickerWidget.show()


if (__name__ == '__main__'):
    from DTL.qt.QtGui import QVBoxLayout
    from DTL.gui import Core, Dialog
    dlg = Dialog()
    dlg.setWindowTitle('Color Test')
    layout = QVBoxLayout()
    layout.addWidget(ColorPickerWidget(dlg))
    layout.addWidget(ColorPickerButton(dlg))
    dlg.setLayout(layout)
    dlg.show()
    Core.Start()