summaryrefslogtreecommitdiff
path: root/src/modelutils.h
diff options
context:
space:
mode:
authorMikaƫl Capelle <capelle.mikael@gmail.com>2021-01-10 10:25:37 +0100
committerGitHub <noreply@github.com>2021-01-10 10:25:37 +0100
commit80e44a9e3ade61695b4807a3a900d2866138ecac (patch)
tree1ef9904664d8d34dba6692bbf5325aea8c199d08 /src/modelutils.h
parenteaec140f7c823012c09536175d8917dddcacdb7c (diff)
parent4a0ce804ea486744e5f6140a0ce4538d99e21ce3 (diff)
Merge pull request #1338 from Holt59/collapsible-separators
Collapsible separators (and refactoring).
Diffstat (limited to 'src/modelutils.h')
-rw-r--r--src/modelutils.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/modelutils.h b/src/modelutils.h
new file mode 100644
index 00000000..e6510941
--- /dev/null
+++ b/src/modelutils.h
@@ -0,0 +1,25 @@
+#ifndef MODELUTILS_H
+#define MODELUTILS_H
+
+#include <QAbstractItemView>
+#include <QAbstractItemModel>
+#include <QColor>
+
+namespace MOShared {
+
+// retrieve all the row index under the given parent
+QModelIndexList flatIndex(
+ const QAbstractItemModel* model, int column = 0, const QModelIndex& parent = QModelIndex());
+
+// retrieve all the visible index in the given view
+QModelIndexList visibleIndex(QTreeView* view, int column = 0);
+
+// convert back-and-forth through model proxies
+QModelIndex indexModelToView(const QModelIndex& index, const QAbstractItemView* view);
+QModelIndexList indexModelToView(const QModelIndexList& index, const QAbstractItemView* view);
+QModelIndex indexViewToModel(const QModelIndex& index, const QAbstractItemModel* model);
+QModelIndexList indexViewToModel(const QModelIndexList& index, const QAbstractItemModel* model);
+
+}
+
+#endif