Added a Notify class
[shopper.git] / src / CatListModel.h
blob71353441fe9aaeb5652d51115b7d54518cf88fdc
1 /* Shopper
2 * Copyright (C) 2008 David Greaves
4 * This software is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1 of
7 * the License, or (at your option) any later version.
9 * This software is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this software; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA
20 #ifndef CATLISTMODEL_H
21 #define CATLISTMODEL_H
23 #include "shopperList.h"
24 #include <QAbstractListModel>
26 namespace Shopper
28 class CatListModel : public QAbstractTableModel
30 Q_OBJECT;
31 public:
32 CatListModel(Shopper::List &l, bool show_everything = true);
33 int rowCount(const QModelIndex & parent = QModelIndex()) const;
34 int columnCount(const QModelIndex & parent = QModelIndex()) const;
35 // QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole );
36 QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
37 QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
38 int currentIndex();
40 static const int ptrIndex = 0;
41 static const int nameIndex = 1;
42 private:
43 Shopper::List *mylist;
44 bool show_everything; // If this is true then index 0 is "Everything"
45 // else index 0 is the first category
46 int indexOfCurrentCat();
47 public slots:
48 void listChanged();
49 void activeCategoryChanged();
50 signals:
51 void currentChanged(int);
55 #endif //CATLISTMODEL_H