diff --git a/paletteeditor/paletteeditor.cpp b/paletteeditor/paletteeditor.cpp index 4b9917c..965cd67 100644 --- a/paletteeditor/paletteeditor.cpp +++ b/paletteeditor/paletteeditor.cpp @@ -31,13 +31,17 @@ PaletteEditor::PaletteEditor(QWidget *parent) auto *const delegate = new ColorDelegate(this); m_ui->paletteView->setItemDelegate(delegate); m_ui->paletteView->setEditTriggers(QAbstractItemView::AllEditTriggers); - connect(m_paletteModel, &PaletteModel::paletteChanged, this, &PaletteEditor::paletteChanged); m_ui->paletteView->setSelectionBehavior(QAbstractItemView::SelectRows); m_ui->paletteView->setDragEnabled(true); m_ui->paletteView->setDropIndicatorShown(true); m_ui->paletteView->setRootIsDecorated(false); m_ui->paletteView->setColumnHidden(2, true); m_ui->paletteView->setColumnHidden(3, true); + + connect(m_paletteModel, &PaletteModel::paletteChanged, this, &PaletteEditor::paletteChanged); + connect(m_ui->buildButton, &ColorButton::colorChanged, this, &PaletteEditor::buildPalette); + connect(m_ui->computeRadio, &QRadioButton::clicked, this, &PaletteEditor::handleComputeRadioClicked); + connect(m_ui->detailsRadio, &QRadioButton::clicked, this, &PaletteEditor::handleDetailsRadioClicked); } PaletteEditor::~PaletteEditor() @@ -93,29 +97,6 @@ void PaletteEditor::setPalette(const QPalette &palette, const QPalette &parentPa setPalette(palette); } -void PaletteEditor::handleBuildButtonColorChanged(const QColor &) -{ - buildPalette(); -} - -void PaletteEditor::handleActiveRadioClicked() -{ - m_currentColorGroup = QPalette::Active; - updatePreviewPalette(); -} - -void PaletteEditor::handleInactiveRadioClicked() -{ - m_currentColorGroup = QPalette::Inactive; - updatePreviewPalette(); -} - -void PaletteEditor::handleDisabledRadioClicked() -{ - m_currentColorGroup = QPalette::Disabled; - updatePreviewPalette(); -} - void PaletteEditor::handleComputeRadioClicked() { if (m_compute) { diff --git a/paletteeditor/paletteeditor.h b/paletteeditor/paletteeditor.h index abc7319..a78190e 100644 --- a/paletteeditor/paletteeditor.h +++ b/paletteeditor/paletteeditor.h @@ -39,18 +39,12 @@ public: void setPalette(const QPalette &palette, const QPalette &parentPalette); private Q_SLOTS: - void handleBuildButtonColorChanged(const QColor &); - void handleActiveRadioClicked(); - void handleInactiveRadioClicked(); - void handleDisabledRadioClicked(); + void buildPalette(); + void paletteChanged(const QPalette &palette); void handleComputeRadioClicked(); void handleDetailsRadioClicked(); - void paletteChanged(const QPalette &palette); - private: - void buildPalette(); - void updatePreviewPalette(); void updateStyledButton();