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