1 #ifndef _SEQUENCE_LOCATION_MODEL_HPP_
2 #define _SEQUENCE_LOCATION_MODEL_HPP_
5 #include <QAbstractTableModel>
6 #include "alg/sequence_location.hpp"
9 class SequenceLocationModel : public QAbstractTableModel
14 SequenceLocationModel(QObject *parent = 0);
16 typedef std::vector<SequenceLocation> model_type;
17 typedef model_type::size_type size_type;
18 typedef model_type::iterator iterator;
19 typedef model_type::const_iterator const_iterator;
20 //! \defgroup VectorInterface
21 //! \addtogroup VectorInterface
23 //! assign num copies of val to our vector
24 void assign(size_type num, const SequenceLocation& val);
25 //! return a specific element
26 SequenceLocation& at(size_type index);
27 //! return the last element
28 SequenceLocation& back();
29 //! return an iterator to the beginning of the model
31 //! return an iterator to the beginning of the model
32 const_iterator begin() const;
35 //! return an iterator to the end of the model
37 //! return an iterator to the end of the model
38 const_iterator end() const;
39 //! is the model empty?
41 //! return a specific element
42 SequenceLocation& operator[](size_type index);
43 //! remove the last element from our model
45 //! add a sequence location to the end of our model
46 void push_back(SequenceLocation&);
47 //! how many elements are in our model.
48 size_type size() const;
51 //! \defgroup QtModelInterface
52 //! \addtogroup QtModel
54 int rowCount(const QModelIndex& parent=QModelIndex()) const;
55 int columnCount(const QModelIndex& parent=QModelIndex()) const;
56 QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const;
58 QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const;
60 bool setData(const QModelIndex& index, const QVariant &value,
61 int role=Qt::EditRole);
62 Qt::ItemFlags flags(const QModelIndex& index) const;
64 //bool insertRows(int row, int count,
65 // const QModelIndex& parent=QModelIndex());
66 //bool removeRows(int row, int count,
67 // const QModelIndex& parent=QModelIndex());
70 model_type sequence_locations;