oopapidocs
2.0
|
00001 #ifndef ACTIONTABLEMODEL_H 00002 #define ACTIONTABLEMODEL_H 00003 00004 #include <QAbstractTableModel> 00005 #include <QList> 00006 #include "actioneditor_export.h" 00007 class QAction; 00008 00013 //start 00014 class ACTIONEDITOR_EXPORT ActionTableModel : public QAbstractTableModel { 00015 Q_OBJECT 00016 public: 00017 explicit ActionTableModel(QList<QAction*> actions, QObject* parent=0); 00018 int rowCount(const QModelIndex& = QModelIndex()) const { 00019 return m_actions.size(); 00020 } 00021 int columnCount(const QModelIndex& = QModelIndex()) const { 00022 return m_columns; 00023 } 00024 QAction* action(int row) const; 00025 00026 QVariant headerData(int section, Qt::Orientation orientation, /* Optional override. */ 00027 int role) const; 00028 QVariant data(const QModelIndex& index, int role) const; /* Required override. */ 00029 Qt::ItemFlags flags(const QModelIndex& index) const; /* required override. */ 00030 bool setData(const QModelIndex& index, const QVariant& value, 00031 int role = Qt::EditRole); /* Required for an editable model. */ 00032 00033 protected: 00034 QList<QAction*> m_actions; 00035 int m_columns; 00036 }; 00037 //end 00038 #endif // ACTIONTABLEMODEL_H