Changeset - 08b87927957a
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-01-29 13:55:27
hy@ozderya.net
get channel colors from infomodel
4 files changed with 10 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/plotmanager.cpp
Show inline comments
 
@@ -273,13 +273,15 @@ void PlotManager::addCurve(QString title
 
void PlotManager::_addCurve(QwtPlotCurve* curve)
 
{
 
    // store and init the curve
 
    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<QColor>();
 
    curve->setPen(color);
 

	
 
    // create the plot for the curve if we are on multi display
 
    Plot* plot;
 
    if (isMulti)
 
    {
 
        // create a new plot widget
src/snapshot.cpp
Show inline comments
 
@@ -104,12 +104,17 @@ void Snapshot::setName(QString name)
 
{
 
    _name = name;
 
    _showAction.setText(_name);
 
    emit nameChanged(this);
 
}
 

	
 
ChannelInfoModel* Snapshot::infoModel()
 
{
 
    return &cInfoModel;
 
}
 

	
 
QString Snapshot::channelName(unsigned channel)
 
{
 
    return cInfoModel.data(cInfoModel.index(channel, ChannelInfoModel::COLUMN_NAME),
 
                           Qt::DisplayRole).toString();
 
}
 

	
src/snapshot.h
Show inline comments
 
@@ -42,12 +42,13 @@ public:
 
    QVector<QVector<QPointF>> data;
 
    QAction* showAction();
 
    QAction* deleteAction();
 

	
 
    QString name();
 
    QString displayName(); ///< `name()` plus '*' if snapshot is not saved
 
    ChannelInfoModel* infoModel();
 
    void setName(QString name);
 
    QString channelName(unsigned channel);
 

	
 
    void save(QString fileName); ///< save snapshot data as CSV
 
    bool isSaved(); ///< snapshot has been saved at least once
 

	
src/snapshotview.cpp
Show inline comments
 
@@ -26,13 +26,13 @@ SnapshotView::SnapshotView(QWidget *pare
 
    renameDialog(this)
 
{
 
    _snapshot = snapshot;
 

	
 
    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());
 

	
 
    // initialize curves
 
    unsigned numOfChannels = snapshot->data.size();
0 comments (0 inline, 0 general)