Quark  0.1
BasicTableModel.h++
Go to the documentation of this file.
1 
2 #ifndef __libquark_gui_BasicTableModel_hxx
3 #define __libquark_gui_BasicTableModel_hxx
4 
6 
7 namespace quark {
8 namespace gui {
9 
16 template<class T, class IS = QDataStream, class OS = QDataStream>
17 class BasicTableModel : public AbstractTableModel<T, IS, OS>
18 {
19  public:
20 
22  virtual ~BasicTableModel();
23 
24  virtual int itemCount() const;
25  virtual int indexOf(const T *item) const;
26 
27  protected:
28 
30  typedef AbstractTableModelBase::Options Options;
31 
32  BasicTableModel(QFlags<Option> options = 0, QObject *parent = NULL);
33 
34  virtual T *getAt(int row) const;
35  virtual T *takeAt(int row);
36  virtual void insertAt(T *item, int row);
37  virtual void removeAll();
38 
39  private:
40 
41  QVector<T *> _data;
42 };
43 
44 #include <quark/BasicTableModelImpl.h++>
45 
46 } // namespace gui
47 } // namespace quark
48 
49 #endif // __libquark_gui_BasicTableModel_hxx
BasicTableModel(QFlags< Option > options=0, QObject *parent=NULL)
virtual T * takeAt(int row)
Removes and returns the item at the given row.
Option
Model options.
Definition: AbstractTableModelBase.h++:27
virtual void insertAt(T *item, int row)
Inserts an item at the given row, or at the end if the row is negative.
AbstractTableModelBase::Options Options
Definition: BasicTableModel.h++:30
virtual void removeAll()
Removes all items from the model.
virtual int itemCount() const
Returns the number of items in the model.
Definition: BarChartView.h++:6
A partial implementation of AbstractTableModel that stores its elements in a QVector.
Definition: BasicTableModel.h++:17
virtual ~BasicTableModel()
Destructor.
An abstract base class for table data models, i.e., models in which every row represents an instance ...
Definition: AbstractTableModel.h++:40
virtual QModelIndex parent(const QModelIndex &index) const
Specified by QAbstractItemModel.
virtual int indexOf(const T *item) const
Returns the row position of the given item in the model.
virtual T * getAt(int row) const
Returns the item at the given row.
AbstractTableModelBase::Option Option
Definition: BasicTableModel.h++:29