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/icondelegate.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/icondelegate.cpp') diff --git a/src/icondelegate.cpp b/src/icondelegate.cpp index 23235814..bec7d995 100644 --- a/src/icondelegate.cpp +++ b/src/icondelegate.cpp @@ -18,41 +18,42 @@ along with Mod Organizer. If not, see . */ #include "icondelegate.h" -#include +#include #include #include #include -#include #include +#include using namespace MOBase; -IconDelegate::IconDelegate(QTreeView* view, int column, int compactSize) : - QStyledItemDelegate(view), m_column(column), m_compactSize(compactSize), m_compact(false) +IconDelegate::IconDelegate(QTreeView* view, int column, int compactSize) + : QStyledItemDelegate(view), m_column(column), m_compactSize(compactSize), + m_compact(false) { if (view) { - connect(view->header(), &QHeaderView::sectionResized, [=](int column, int, int size) { - if (column == m_column) { - m_compact = size < m_compactSize; - } - }); + connect(view->header(), &QHeaderView::sectionResized, + [=](int column, int, int size) { + if (column == m_column) { + m_compact = size < m_compactSize; + } + }); } } -void IconDelegate::paintIcons( - QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index, const QList& icons) +void IconDelegate::paintIcons(QPainter* painter, const QStyleOptionViewItem& option, + const QModelIndex& index, const QList& icons) { int x = 4; painter->save(); int iconWidth = icons.size() > 0 ? ((option.rect.width() / icons.size()) - 4) : 16; - iconWidth = std::min(16, iconWidth); + iconWidth = std::min(16, iconWidth); const int margin = (option.rect.height() - iconWidth) / 2; painter->translate(option.rect.topLeft()); - for (const QString &iconId : icons) { + for (const QString& iconId : icons) { if (iconId.isEmpty()) { x += iconWidth + 4; continue; @@ -73,15 +74,14 @@ void IconDelegate::paintIcons( painter->restore(); } -void IconDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +void IconDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, + const QModelIndex& index) const { if (auto* w = qobject_cast(parent())) { w->itemDelegate()->paint(painter, option, index); - } - else { + } else { QStyledItemDelegate::paint(painter, option, index); } paintIcons(painter, option, index, getIcons(index)); } - -- cgit v1.3.1