Adds the code to make the dive list behave like tree or list

This code adds the possibility to make the DiveList behave
like a Tree or a List, depending on what layout is set.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-05-28 16:56:58 -03:00
parent 8394828806
commit c6f84de37c
3 changed files with 35 additions and 3 deletions

View file

@ -144,6 +144,8 @@ class DiveTripModel : public QAbstractItemModel
Q_OBJECT
public:
enum Layout{TREE, LIST};
DiveTripModel(QObject *parent = 0);
~DiveTripModel();
@ -155,11 +157,14 @@ public:
/*reimp*/ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
/*reimp*/ QModelIndex parent(const QModelIndex &child) const;
Layout layout() const;
void setLayout(Layout layout);
private:
void setupModelData();
TreeItemDT *rootItem;
QMap<dive_trip_t*, TripItem*> trips;
Layout currentLayout;
};
#endif