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/settings.cpp | |
| parent | fff41be8455e588d181c7349678dff6fe29be76b (diff) | |
Fix position of markers in scrollbar for non-flat models.
Diffstat (limited to 'src/settings.cpp')
| -rw-r--r-- | src/settings.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index b6961807..0e2de9d7 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -24,6 +24,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "instancemanager.h" #include "shared/appconfig.h" #include "env.h" +#include "modelutils.h" #include "envmetrics.h" #include <expanderwidget.h> #include <utility.h> @@ -1063,22 +1064,10 @@ WidgetSettings::WidgetSettings(QSettings& s, bool globalInstance) } } -std::vector<QModelIndex> WidgetSettings::allIndex(const QAbstractItemModel* model, int column, const QModelIndex& parent) const -{ - std::vector<QModelIndex> index; - for (std::size_t i = 0; i < model->rowCount(parent); ++i) { - index.push_back(model->index(i, column, parent)); - - auto cindex = allIndex(model, column, index.back()); - index.insert(index.end(), cindex.begin(), cindex.end()); - } - return index; -} - void WidgetSettings::saveTreeState(const QTreeView* tv, int role) { QVariantList expanded; - for (auto index : allIndex(tv->model())) { + for (auto index : flatIndex(tv->model())) { if (tv->isExpanded(index)) { expanded.append(index.data(role)); } @@ -1090,7 +1079,7 @@ void WidgetSettings::restoreTreeState(QTreeView* tv, int role) const { if (auto expanded = getOptional<QVariantList>(m_Settings, "Widgets", indexSettingName(tv))) { tv->collapseAll(); - for (auto index : allIndex(tv->model())) { + for (auto index : flatIndex(tv->model())) { if (expanded->contains(index.data(role))) { tv->expand(index); } |
