# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2017-01-29 13:55:27 # Node ID 08b87927957a007c7cb2d825480e837e9e9daa34 # Parent 4bc5e4951d47e2c5ab2ac5b1d169c1152f274a2b get channel colors from infomodel diff --git a/src/plotmanager.cpp b/src/plotmanager.cpp --- a/src/plotmanager.cpp +++ b/src/plotmanager.cpp @@ -276,7 +276,9 @@ void PlotManager::_addCurve(QwtPlotCurve curves.append(curve); unsigned index = curves.size()-1; - curve->setPen(Plot::makeColor(index)); + auto color = _infoModel->index(index, ChannelInfoModel::COLUMN_NAME)\ + .data(Qt::ForegroundRole).value(); + curve->setPen(color); // create the plot for the curve if we are on multi display Plot* plot; diff --git a/src/snapshot.cpp b/src/snapshot.cpp --- a/src/snapshot.cpp +++ b/src/snapshot.cpp @@ -107,6 +107,11 @@ void Snapshot::setName(QString name) emit nameChanged(this); } +ChannelInfoModel* Snapshot::infoModel() +{ + return &cInfoModel; +} + QString Snapshot::channelName(unsigned channel) { return cInfoModel.data(cInfoModel.index(channel, ChannelInfoModel::COLUMN_NAME), diff --git a/src/snapshot.h b/src/snapshot.h --- a/src/snapshot.h +++ b/src/snapshot.h @@ -45,6 +45,7 @@ public: QString name(); QString displayName(); ///< `name()` plus '*' if snapshot is not saved + ChannelInfoModel* infoModel(); void setName(QString name); QString channelName(unsigned channel); diff --git a/src/snapshotview.cpp b/src/snapshotview.cpp --- a/src/snapshotview.cpp +++ b/src/snapshotview.cpp @@ -29,7 +29,7 @@ SnapshotView::SnapshotView(QWidget *pare ui->setupUi(this); - plotMan = new PlotManager(ui->plotArea); + plotMan = new PlotManager(ui->plotArea, snapshot->infoModel()); ui->menuSnapshot->insertAction(ui->actionClose, snapshot->deleteAction()); this->setWindowTitle(snapshot->displayName());