From 5e5c9c07291f6b09623d31c92b1fb61c4ede576e Mon Sep 17 00:00:00 2001 From: Sandro Jäckel Date: Thu, 22 Feb 2018 16:54:34 +0100 Subject: Applied clang-format on source --- src/modlistview.cpp | 67 +++++++++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 38 deletions(-) (limited to 'src/modlistview.cpp') diff --git a/src/modlistview.cpp b/src/modlistview.cpp index fe2d3e57..9b98a3b7 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -1,56 +1,47 @@ #include "modlistview.h" -#include #include #include +#include - -class ModListViewStyle: public QProxyStyle { +class ModListViewStyle : public QProxyStyle { public: - ModListViewStyle(QStyle *style, int indentation); + ModListViewStyle(QStyle* style, int indentation); + + void drawPrimitive(PrimitiveElement element, const QStyleOption* option, QPainter* painter, + const QWidget* widget = 0) const; - void drawPrimitive (PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget = 0) const; private: - int m_Indentation; + int m_Indentation; }; -ModListViewStyle::ModListViewStyle(QStyle *style, int indentation) - : QProxyStyle(style), m_Indentation(indentation) -{ -} - -void ModListViewStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const -{ - if (element == QStyle::PE_IndicatorItemViewItemDrop && !option->rect.isNull()) { - QStyleOption opt(*option); - opt.rect.setLeft(m_Indentation); - if (widget) { - opt.rect.setRight(widget->width() - 5); // 5 is an arbitrary value that seems to work ok +ModListViewStyle::ModListViewStyle(QStyle* style, int indentation) : QProxyStyle(style), m_Indentation(indentation) {} + +void ModListViewStyle::drawPrimitive(PrimitiveElement element, const QStyleOption* option, QPainter* painter, + const QWidget* widget) const { + if (element == QStyle::PE_IndicatorItemViewItemDrop && !option->rect.isNull()) { + QStyleOption opt(*option); + opt.rect.setLeft(m_Indentation); + if (widget) { + opt.rect.setRight(widget->width() - 5); // 5 is an arbitrary value that seems to work ok + } + QProxyStyle::drawPrimitive(element, &opt, painter, widget); + } else { + QProxyStyle::drawPrimitive(element, option, painter, widget); } - QProxyStyle::drawPrimitive(element, &opt, painter, widget); - } else { - QProxyStyle::drawPrimitive(element, option, painter, widget); - } } -ModListView::ModListView(QWidget *parent) - : QTreeView(parent) - , m_Scrollbar(new ViewMarkingScrollBar(this->model(), this)) -{ - setVerticalScrollBar(m_Scrollbar); +ModListView::ModListView(QWidget* parent) + : QTreeView(parent), m_Scrollbar(new ViewMarkingScrollBar(this->model(), this)) { + setVerticalScrollBar(m_Scrollbar); } -void ModListView::dragEnterEvent(QDragEnterEvent *event) -{ - emit dropModeUpdate(event->mimeData()->hasUrls()); +void ModListView::dragEnterEvent(QDragEnterEvent* event) { + emit dropModeUpdate(event->mimeData()->hasUrls()); - QTreeView::dragEnterEvent(event); + QTreeView::dragEnterEvent(event); } -void ModListView::setModel(QAbstractItemModel *model) -{ - QTreeView::setModel(model); - setVerticalScrollBar(new ViewMarkingScrollBar(model, this)); +void ModListView::setModel(QAbstractItemModel* model) { + QTreeView::setModel(model); + setVerticalScrollBar(new ViewMarkingScrollBar(model, this)); } - -- cgit v1.3.1