Changeset - 840ec925ba83
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-01-30 04:05:29
hy@ozderya.net
api for simpler access to channel info
4 files changed with 21 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/channelinfomodel.cpp
Show inline comments
 
@@ -98,6 +98,21 @@ ChannelInfoModel::ChannelInfo::ChannelIn
 
    color = colors[index % NUMOF_COLORS];
 
}
 

	
 
QString ChannelInfoModel::name(unsigned i)
 
{
 
    return infos[i].name;
 
}
 

	
 
QColor ChannelInfoModel::color(unsigned i)
 
{
 
    return infos[i].color;
 
}
 

	
 
bool ChannelInfoModel::isVisible(unsigned i)
 
{
 
    return infos[i].visibility;
 
}
 

	
 
int ChannelInfoModel::rowCount(const QModelIndex &parent) const
 
{
 
    return _numOfChannels;
src/channelinfomodel.h
Show inline comments
 
@@ -41,6 +41,10 @@ public:
 
    ChannelInfoModel(const ChannelInfoModel& other);
 
    explicit ChannelInfoModel(const QStringList& channelNames);
 

	
 
    QString name     (unsigned i);
 
    QColor  color    (unsigned i);
 
    bool    isVisible(unsigned i);
 

	
 
    // implemented from QAbstractItemModel
 
    int           rowCount(const QModelIndex &parent = QModelIndex()) const;
 
    int           columnCount(const QModelIndex &parent = QModelIndex()) const;
src/plotmanager.cpp
Show inline comments
 
@@ -276,8 +276,7 @@ void PlotManager::_addCurve(QwtPlotCurve
 
    curves.append(curve);
 

	
 
    unsigned index = curves.size()-1;
 
    auto color = _infoModel->index(index, ChannelInfoModel::COLUMN_NAME)\
 
        .data(Qt::ForegroundRole).value<QColor>();
 
    auto color = _infoModel->color(index);
 
    curve->setPen(color);
 

	
 
    // create the plot for the curve if we are on multi display
src/snapshot.cpp
Show inline comments
 
@@ -114,8 +114,7 @@ ChannelInfoModel* Snapshot::infoModel()
 

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

	
 
void Snapshot::save(QString fileName)
0 comments (0 inline, 0 general)