diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-12-31 23:36:14 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 15:38:18 +0100 |
| commit | 87dac464d9ec488737b16839b0f06586eadb837e (patch) | |
| tree | 3502cdcef4e27742f3b3ae1031371dafb15b2714 /src/modelutils.cpp | |
| parent | fff41be8455e588d181c7349678dff6fe29be76b (diff) | |
Fix position of markers in scrollbar for non-flat models.
Diffstat (limited to 'src/modelutils.cpp')
| -rw-r--r-- | src/modelutils.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/modelutils.cpp b/src/modelutils.cpp index 43aa6b99..d464bb91 100644 --- a/src/modelutils.cpp +++ b/src/modelutils.cpp @@ -2,6 +2,17 @@ #include <QAbstractProxyModel> +QModelIndexList flatIndex( + const QAbstractItemModel* model, int column, const QModelIndex& parent) +{ + QModelIndexList index; + for (std::size_t i = 0; i < model->rowCount(parent); ++i) { + index.append(model->index(i, column, parent)); + index.append(flatIndex(model, column, index.back())); + } + return index; +} + QModelIndex indexModelToView(const QModelIndex& index, const QAbstractItemView* view) { // we need to stack the proxy |
