parley
kvtlessonmodel.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 KVTLESSONMODEL_H
00023 #define KVTLESSONMODEL_H
00024
00025 #include <QAbstractListModel>
00026 #include <QModelIndex>
00027
00028 #include <QObject>
00029
00030 #include <keduvocdocument.h>
00031
00036 class KVTLessonModel : public QAbstractListModel
00037 {
00038 Q_OBJECT
00039
00040 public:
00042 enum SplitLessonOrder {
00043 sorted,
00044 random
00045 };
00046
00047 KVTLessonModel(QObject *parent = 0) : QAbstractListModel(parent)
00048 {
00049 m_doc = 0;
00050 }
00053 void setDocument(KEduVocDocument * doc);
00054 KEduVocDocument * document() const
00055 {
00056 return m_doc;
00057 }
00061 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00063 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00067 Qt::ItemFlags flags(const QModelIndex &index) const;
00072 QVariant data(const QModelIndex &index, int role) const;
00073
00079 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
00080
00081
00082 int currentLesson() const
00083 {
00084 return m_doc->currentLesson();
00085 }
00086 void setCurrentLesson(int index)
00087 {
00088 m_doc->setCurrentLesson(index);
00089 setModified(true);
00090 }
00091 void setModified(bool modified)
00092 {
00093 m_doc->setModified(modified);
00094 }
00095
00097 void setAllLessonsInPractice();
00099 void setNoLessonsInPractice();
00100
00101
00102 int addLesson(const QString &lessonName = QString());
00103
00104 bool deleteLesson(int lessonIndex, KEduVocDocument::LessonDeletion mode);
00105
00106 Qt::DropActions supportedDropActions() const;
00107
00108 bool removeRows(int row, int count, const QModelIndex &parent);
00109 bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
00110
00111
00119 void splitLesson(int lessonIndex, int entriesPerLesson, SplitLessonOrder order);
00120
00121
00122 private:
00124 KEduVocDocument *m_doc;
00125
00126
00127
00128 };
00129
00130 #endif