File indexing completed on 2024-05-19 05:41:18
0001 #ifndef DICEBOOKMARKMODEL_H 0002 #define DICEBOOKMARKMODEL_H 0003 0004 #include "data/diceshortcut.h" 0005 #include "rwidgets_global.h" 0006 #include <QAbstractTableModel> 0007 #include <QSettings> 0008 /** 0009 * @brief The DiceBookMarkModel class 0010 */ 0011 class RWIDGET_EXPORT DiceBookMarkModel : public QAbstractTableModel 0012 { 0013 Q_OBJECT 0014 0015 public: 0016 explicit DiceBookMarkModel(std::vector<DiceShortCut>& data, QObject* parent= nullptr); 0017 0018 // Header: 0019 QVariant headerData(int section, Qt::Orientation orientation, int role= Qt::DisplayRole) const override; 0020 0021 // Basic functionality: 0022 int rowCount(const QModelIndex& parent= QModelIndex()) const override; 0023 int columnCount(const QModelIndex& parent= QModelIndex()) const override; 0024 0025 QVariant data(const QModelIndex& index, int role= Qt::DisplayRole) const override; 0026 0027 // Editable: 0028 bool setData(const QModelIndex& index, const QVariant& value, int role= Qt::EditRole) override; 0029 0030 Qt::ItemFlags flags(const QModelIndex& index) const override; 0031 0032 // Add data: 0033 bool appendRows(); 0034 0035 // Remove data: 0036 bool removeRows(int row, int count, const QModelIndex& parent= QModelIndex()) override; 0037 0038 QMimeData* mimeData(const QModelIndexList& indexes) const override; 0039 QStringList mimeTypes() const override; 0040 0041 void writeSettings(QSettings& settings); 0042 void readSettings(QSettings& settings); 0043 0044 private: 0045 std::vector<DiceShortCut>& m_data; 0046 }; 0047 0048 #endif // DICEBOOKMARKMODEL_H