00001
00002
00003
00004
00005
00006
00007 #ifndef SHORTCUTMODEL_H
00008 #define SHORTCUTMODEL_H
00009
00010 #include <QAbstractTableModel>
00011 #include <QPair>
00012
00013
00024 class ShortcutModel : public QAbstractTableModel
00025 {
00026 Q_OBJECT
00027
00028 public:
00029 ShortcutModel(QObject * parent = 0);
00030 ~ShortcutModel();
00031
00032 int rowCount(const QModelIndex & parent = QModelIndex()) const;
00033 int columnCount(const QModelIndex & parent = QModelIndex()) const;
00034
00035 QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
00036 bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
00037
00038 Qt::ItemFlags flags(const QModelIndex & index) const;
00039
00040 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00041
00042 bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
00043 bool insertRows( int row, int count, const QModelIndex & parent = QModelIndex());
00044 void insertRow();
00045 void insertRow(QString key, QString value);
00046
00047 QList<QPair<QString,QString> > values() { return m_values; };
00049 void saveValues();
00050
00051 signals:
00054 void valueChanged();
00057 void keysNotUnique(QString);
00058
00059 private:
00060 QList<QPair<QString,QString> > m_values;
00061 };
00062
00063 #endif