00001 00042 #ifndef AIUNDOMODEL_HPP 00043 #define AIUNDOMODEL_HPP 00044 00045 #include <QtGui> 00046 #include "../aiview/aicommand/aicommand.hpp" 00047 00048 namespace AiFractals 00049 { 00056 class AiUndoModel : public QAbstractItemModel 00057 { 00058 Q_OBJECT 00059 00060 public: 00061 00066 AiUndoModel( QObject *parent = 0 ); 00067 00068 QUndoStack *getStack() const; 00069 00070 void setStack( QUndoStack * stack ); 00071 00072 virtual QModelIndex index(int row, int column, 00073 const QModelIndex &parent = QModelIndex()) const; 00074 00075 virtual QModelIndex parent(const QModelIndex &child) const; 00076 00077 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; 00078 00079 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; 00080 00081 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 00082 00083 QModelIndex selectedIndex() const; 00084 00085 void setStackCurrentIndex( const QModelIndex &index ); 00086 00087 private slots: 00088 00089 void stackChanged(); 00090 00091 private: 00092 00093 QUndoStack *m_stack; 00094 00095 }; 00096 00097 } 00098 00099 #endif // AIUNDOMODEL_HPP