From d13f6bb870cdda71257f665367be8ef9fca86255 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Tue, 17 May 2022 11:47:01 +0200 Subject: Apply clang-format. --- src/modelutils.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/modelutils.cpp') diff --git a/src/modelutils.cpp b/src/modelutils.cpp index 83054806..1cdf9657 100644 --- a/src/modelutils.cpp +++ b/src/modelutils.cpp @@ -2,10 +2,11 @@ #include -namespace MOShared { +namespace MOShared +{ -QModelIndexList flatIndex( - const QAbstractItemModel* model, int column, const QModelIndex& parent) +QModelIndexList flatIndex(const QAbstractItemModel* model, int column, + const QModelIndex& parent) { QModelIndexList index; for (std::size_t i = 0; i < model->rowCount(parent); ++i) { @@ -15,7 +16,8 @@ QModelIndexList flatIndex( return index; } -static QModelIndexList visibleIndexImpl(QTreeView* view, int column, const QModelIndex& parent) +static QModelIndexList visibleIndexImpl(QTreeView* view, int column, + const QModelIndex& parent) { if (parent.isValid() && !view->isExpanded(parent)) { return {}; @@ -59,7 +61,8 @@ QModelIndex indexModelToView(const QModelIndex& index, const QAbstractItemView* return qindex; } -QModelIndexList indexModelToView(const QModelIndexList& index, const QAbstractItemView* view) +QModelIndexList indexModelToView(const QModelIndexList& index, + const QAbstractItemView* view) { QModelIndexList result; for (auto& idx : index) { @@ -72,16 +75,15 @@ QModelIndex indexViewToModel(const QModelIndex& index, const QAbstractItemModel* { if (index.model() == model) { return index; - } - else if (auto* proxy = qobject_cast(index.model())) { + } else if (auto* proxy = qobject_cast(index.model())) { return indexViewToModel(proxy->mapToSource(index), model); - } - else { + } else { return QModelIndex(); } } -QModelIndexList indexViewToModel(const QModelIndexList& index, const QAbstractItemModel* model) +QModelIndexList indexViewToModel(const QModelIndexList& index, + const QAbstractItemModel* model) { QModelIndexList result; for (auto& idx : index) { @@ -90,4 +92,4 @@ QModelIndexList indexViewToModel(const QModelIndexList& index, const QAbstractIt return result; } -} +} // namespace MOShared -- cgit v1.3.1