parley
kvttablemodel.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KVTTABLEMODEL_H
00023 #define KVTTABLEMODEL_H
00024
00025 #include <QAbstractTableModel>
00026 #include <QPixmap>
00027
00028 #include <keduvocdocument.h>
00029
00030 #define KV_COL_LESS 0 // col: lesson number
00031 #define KV_COL_MARK 1 // col: mark
00032 #define KV_COL_TRANS 2 // col: first translation
00033
00034
00035
00036
00041 class KVTTableModel : public QAbstractTableModel
00042 {
00043 Q_OBJECT
00044 public:
00045
00046 enum KVTItemDataRole {
00047 LessonsRole = Qt::UserRole + 1,
00048 LessonRole,
00049 StateRole,
00050 GradeRole,
00051 LocaleRole
00052
00053 };
00054
00055 KVTTableModel(QObject *parent = 0);
00056
00057 void setDocument(KEduVocDocument * doc);
00058 KEduVocDocument * document() const
00059 {
00060 return m_doc;
00061 }
00062
00063 bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex());
00064 bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex());
00065
00069 void appendTranslation();
00070
00076 bool removeTranslation(int translationIndex);
00077
00078 int rowCount(const QModelIndex &parent) const;
00079 int columnCount(const QModelIndex &parent) const;
00080
00081 QVariant data(const QModelIndex &index, int role) const;
00082 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
00083
00084 Qt::ItemFlags flags(const QModelIndex &index) const;
00085 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
00086 bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
00087
00088 public slots:
00089 void dataChangedFromOutside(const QModelIndex& topLeft, const QModelIndex& bottomRight);
00090 void appendEntry();
00091
00092 void loadLanguageSettings();
00093
00094 private:
00095 KEduVocDocument * m_doc;
00096 QPixmap m_pixInactive;
00097 QPixmap m_pixInQuery;
00098 QMap<int, QPixmap> m_headerPixmaps;
00099
00100 friend class ParleyApp;
00101 friend class KVTStatisticsDialog;
00102 };
00103
00104 #endif