AnimationModel.qt.H

00001 #ifndef ANIMATIONMODEL_QT_H
00002 #define ANIMATIONMODEL_QT_H
00003 
00004 #include <QtGui/QtGui>
00005 #include "Media/FrameRange.H"
00006 
00007 class AnnotationObject;
00008 class AnnotationObjectVertex;
00009 
00010 class AnimationModel : public QAbstractTableModel
00011 {
00012   Q_OBJECT
00013 
00014   public:
00015     AnimationModel(AnnotationObject *parent);
00016 
00017     //! Get the header names
00018     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00019 
00020     //! Let our view know how many rows to display
00021     int rowCount(const QModelIndex &parent = QModelIndex()) const;
00022 
00023     //! Get the number framers in the animation
00024     int columnCount(const QModelIndex &parent = QModelIndex()) const;
00025 
00026     //! Get a data item from the object list
00027     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
00028 
00029     //! Set a particular frame of this animation
00030     bool setData(const QModelIndex &index, const QVariant &value, int role);
00031 
00032     //! Return the flags of a particular row/column cell
00033     Qt::ItemFlags flags(const QModelIndex &index) const;
00034 
00035     //! Let Qt know that we support move operations
00036     Qt::DropActions supportedDropActions() const;
00037 
00038     //! Insert a new keyframe at frameNumber indicating the object is at position pos
00039     void setPosition(int frameNum, QPointF pos);
00040 
00041     //! Called when a keyframe is dragged to a new position
00042     bool dropMimeData(const QMimeData * data,
00043         Qt::DropAction action,
00044         int row, int col,
00045         const QModelIndex & parent);
00046 
00047     //! A wrapper around the protected QAbstractTableModel::beginInsertRows function
00048     void beginInsertRow(int row);
00049 
00050     //! A wrapper around the protected QAbstractTableModel::endInsertRows function
00051     void endInsertRow();
00052 
00053     //! A wrapper around the protected QAbstractTableModel::beginRemoveRows function
00054     void beginRemoveRow(int row);
00055 
00056     //! A wrapper around the protected QAbstractTableModel::endRemoveRows function
00057     void endRemoveRow();
00058 
00059     //! A wrapper around the protected QAbstractTableModel::beginRemoveRows function
00060     void beginRemoveRowsPub(const QModelIndex & i, int first, int last);
00061 
00062     void setLastClick(const QModelIndex & index) { itsLastClick = index; }
00063 
00064   public slots:
00065     //! Whenever any aspect of the animation has changed, this slot gets called to redraw
00066     //! the whole animation view. This should be reimplemented later to only redraw the
00067     //! changed sections.
00068     void animationChanged();
00069 
00070   private:
00071     AnnotationObject * itsParent;                //!< The AnnotationObject which this model represents
00072 
00073     QList<AnnotationObjectVertex*> *itsVertices; //!< Convenience pointer to the objects vertices
00074 
00075     QPoint itsLastMousePress;
00076 
00077     QModelIndex itsLastClick;
00078 
00079 };
00080 
00081 #endif //ANIMATIONMODEL_QT_H
00082 
Generated on Sun May 8 08:41:02 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3