diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2023-07-09 17:36:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-09 17:36:03 +0200 |
| commit | ef94aee28464039672b277243a0181ae93550d6c (patch) | |
| tree | 0575a68af5f154e9d6d0738edbaefb16a11d6f5c /src/modcontenticondelegate.cpp | |
| parent | 7d6cb8528d20e36a4cee822263865ee2f7f32481 (diff) | |
| parent | 3de050e9c03e553f7ae3f780f6bd080a30ae123e (diff) | |
Merge pull request #1839 from Holt59/ci/initial-gh-action-for-build
Clang-Format + Github Workflow
Diffstat (limited to 'src/modcontenticondelegate.cpp')
| -rw-r--r-- | src/modcontenticondelegate.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/modcontenticondelegate.cpp b/src/modcontenticondelegate.cpp index 57a4dc6d..c2c88933 100644 --- a/src/modcontenticondelegate.cpp +++ b/src/modcontenticondelegate.cpp @@ -2,10 +2,10 @@ #include "modlistview.h" -ModContentIconDelegate::ModContentIconDelegate(ModListView* view, int column, int compactSize) - : IconDelegate(view, column, compactSize), m_view(view) -{ -} +ModContentIconDelegate::ModContentIconDelegate(ModListView* view, int column, + int compactSize) + : IconDelegate(view, column, compactSize), m_view(view) +{} QList<QString> ModContentIconDelegate::getIcons(const QModelIndex& index) const { @@ -30,8 +30,9 @@ size_t ModContentIconDelegate::getNumIcons(const QModelIndex& index) const return getIcons(index).size(); } -bool ModContentIconDelegate::helpEvent( - QHelpEvent* event, QAbstractItemView* view, const QStyleOptionViewItem& option, const QModelIndex& index) +bool ModContentIconDelegate::helpEvent(QHelpEvent* event, QAbstractItemView* view, + const QStyleOptionViewItem& option, + const QModelIndex& index) { if (!event || !view) { return false; @@ -39,19 +40,21 @@ bool ModContentIconDelegate::helpEvent( if (event->type() == QEvent::ToolTip) { // this code is from QAbstractItemDelegate::helpEvent, only the the way // text is retrieved has been changed - QHelpEvent* he = static_cast<QHelpEvent*>(event); - const int precision = inherits("QItemDelegate") ? 10 : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp - const QString tooltip = index.isValid() ? m_view->contentsTooltip(index) : QString(); + QHelpEvent* he = static_cast<QHelpEvent*>(event); + const int precision = inherits("QItemDelegate") + ? 10 + : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp + const QString tooltip = + index.isValid() ? m_view->contentsTooltip(index) : QString(); QRect rect; if (index.isValid()) { const QRect r = view->visualRect(index); - rect = QRect(view->mapToGlobal(r.topLeft()), r.size()); + rect = QRect(view->mapToGlobal(r.topLeft()), r.size()); } QToolTip::showText(he->globalPos(), tooltip, view, rect); event->setAccepted(!tooltip.isEmpty()); return true; - } - else { + } else { return IconDelegate::helpEvent(event, view, option, index); } } |
