src/librariesmodel.h

Fri, 23 Mar 2018 12:51:18 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 23 Mar 2018 12:51:18 +0200
changeset 1308
dcc8c02530c2
child 1326
69a90bd2dba2
permissions
-rw-r--r--

Begin rework to add support for multiple libraries

1308
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include <QAbstractTableModel>
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 #include "main.h"
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 class LibrariesModel : public QAbstractTableModel
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 {
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 public:
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 enum Column { RoleColumn, PathColumn };
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 LibrariesModel(Libraries& libraries, QObject* parent);
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 QVariant data(const QModelIndex& index, int role) const override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 int rowCount(const QModelIndex& parent = {}) const override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 int columnCount(const QModelIndex& parent = {}) const override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 bool setData(const QModelIndex& index, const QVariant& value, int role) override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 Qt::ItemFlags flags(const QModelIndex& index) const override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 bool moveRows(
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 const QModelIndex&,
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 int sourceRow,
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 int count,
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 const QModelIndex&,
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 int destinationRow
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 ) override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 bool removeRows(int row, int count, const QModelIndex&) override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 bool insertRows(int startRow, int count, const QModelIndex&) override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 private:
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 Libraries& libraries;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 };

mercurial