Files
@ ff0a686c939f
Branch filter:
Location: tempo-plotter/src/channelinfomodel.h - annotation
ff0a686c939f
2.2 KiB
text/plain
when channel is deselected disable color selector
a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 371135090df8 6254c449bb19 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 3be63f78737a 3be63f78737a 3be63f78737a 3be63f78737a 3be63f78737a 3be63f78737a 3be63f78737a a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 708985ebaffa 708985ebaffa 708985ebaffa 708985ebaffa 708985ebaffa 9d804dc195ac a8a13a36dd17 a8a13a36dd17 6254c449bb19 6254c449bb19 6254c449bb19 6254c449bb19 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 371135090df8 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 a8a13a36dd17 | /*
Copyright © 2017 Hasan Yavuz Özderya
This file is part of serialplot.
serialplot is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
serialplot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with serialplot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CHANNELINFOMODEL_H
#define CHANNELINFOMODEL_H
#include <QAbstractTableModel>
#include <QColor>
#include <QSettings>
class ChannelInfoModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum ChannelInfoColumn
{
COLUMN_NAME = 0,
COLUMN_VISIBILITY,
COLUMN_COUNT
};
explicit ChannelInfoModel(unsigned numberOfChannels, QObject *parent = 0);
// implemented from QAbstractItemModel
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
void setNumOfChannels(unsigned number);
/// Stores all channel info into a `QSettings`
void saveSettings(QSettings* settings);
/// Loads all channel info from a `QSettings`.
void loadSettings(QSettings* settings);
private:
struct ChannelInfo
{
QString name;
bool visibility;
QColor color;
};
unsigned _numOfChannels; ///< @note this is not necessarily the length of `infos`
/**
* Channel info is added here but never removed so that we can
* remember user entered names.
*/
QList<ChannelInfo> infos;
};
#endif // CHANNELINFOMODEL_H
|