# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2017-01-02 08:56:46 # Node ID ff0a686c939f8bb7822149b4ce6a3233f956550d # Parent fb1bcd21c7509eea0922a751f5e14a1e3ac74304 when channel is deselected disable color selector diff --git a/src/plotcontrolpanel.cpp b/src/plotcontrolpanel.cpp --- a/src/plotcontrolpanel.cpp +++ b/src/plotcontrolpanel.cpp @@ -238,6 +238,20 @@ void PlotControlPanel::setChannelInfoMod ui->colorSelector->blockSignals(wasBlocked); }); + connect(ui->tvChannelInfo->selectionModel(), &QItemSelectionModel::selectionChanged, + [this](const QItemSelection & selected, const QItemSelection & deselected) + { + if (!selected.length()) + { + ui->colorSelector->setDisabled(true); + + // temporarily block signals because `setColor` emits `colorChanged` + bool wasBlocked = ui->colorSelector->blockSignals(true); + ui->colorSelector->setColor(QColor(0,0,0,0)); + ui->colorSelector->blockSignals(wasBlocked); + } + }); + connect(ui->colorSelector, &color_widgets::ColorSelector::colorChanged, [this](QColor color) {