File indexing completed on 2023-05-30 10:45:26
0001 /* 0002 SPDX-FileCopyrightText: 2006-2010 Peter Hedlund <peter.hedlund@kdemail.net> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef KWQTABLEMODEL_H 0007 #define KWQTABLEMODEL_H 0008 0009 #include <QAbstractTableModel> 0010 0011 #include <KImageCache> 0012 0013 #include <keduvocdocument.h> 0014 0015 /** 0016 @author Peter Hedlund <peter.hedlund@kdemail.net> 0017 */ 0018 0019 const char delim_start = '['; 0020 const char delim_end = ']'; 0021 0022 class KWQTableModel : public QAbstractTableModel 0023 { 0024 Q_OBJECT 0025 public: 0026 enum roles { 0027 KeyboardLayoutRole = Qt::UserRole, 0028 ImageRole, 0029 SoundRole 0030 }; 0031 0032 explicit KWQTableModel(QObject * parent = nullptr); 0033 ~KWQTableModel() override; 0034 0035 void setDocument(KEduVocDocument * doc); 0036 KEduVocDocument * document() { return m_doc;}; 0037 bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; 0038 bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; 0039 0040 KEduVocLesson * currentLesson(int row); 0041 0042 int rowCount(const QModelIndex &parent) const override; 0043 int columnCount(const QModelIndex &parent) const override; 0044 0045 QVariant data(const QModelIndex &index, int role) const override; 0046 QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0047 0048 Qt::ItemFlags flags (const QModelIndex & index) const override; 0049 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; 0050 bool setHeaderData (int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole) override; 0051 0052 bool isEmpty(); 0053 bool checkSyntax() const; 0054 bool checkBlanksSyntax(const QString & text) const; 0055 0056 private: 0057 KEduVocDocument * m_doc; 0058 KImageCache *m_decorationCache; 0059 0060 friend class KWordQuizApp; 0061 }; 0062 0063 #endif