diff options
| author | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2018-02-22 16:54:34 +0100 |
|---|---|---|
| committer | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2018-02-22 16:54:34 +0100 |
| commit | 5e5c9c07291f6b09623d31c92b1fb61c4ede576e (patch) | |
| tree | 0684c123db375336e0e03f0240155a12e744db16 /src/pluginlistview.cpp | |
| parent | 5ad912e1934061b38825801a27f7c12933878005 (diff) | |
Applied clang-format on source
Diffstat (limited to 'src/pluginlistview.cpp')
| -rw-r--r-- | src/pluginlistview.cpp | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/src/pluginlistview.cpp b/src/pluginlistview.cpp index 0fcf8183..9d38af62 100644 --- a/src/pluginlistview.cpp +++ b/src/pluginlistview.cpp @@ -1,58 +1,50 @@ #include "pluginlistview.h" -#include <QUrl> #include <QMimeData> #include <QProxyStyle> - +#include <QUrl> class PluginListViewStyle : public QProxyStyle { public: - PluginListViewStyle(QStyle *style, int indentation); + PluginListViewStyle(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; }; -PluginListViewStyle::PluginListViewStyle(QStyle *style, int indentation) - : QProxyStyle(style), m_Indentation(indentation) -{ -} +PluginListViewStyle::PluginListViewStyle(QStyle* style, int indentation) + : QProxyStyle(style), m_Indentation(indentation) {} -void PluginListViewStyle::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 +void PluginListViewStyle::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); - } } -PluginListView::PluginListView(QWidget *parent) - : QTreeView(parent) - , m_Scrollbar(new ViewMarkingScrollBar(this->model(), this)) -{ - setVerticalScrollBar(m_Scrollbar); +PluginListView::PluginListView(QWidget* parent) + : QTreeView(parent), m_Scrollbar(new ViewMarkingScrollBar(this->model(), this)) { + setVerticalScrollBar(m_Scrollbar); } -void PluginListView::dragEnterEvent(QDragEnterEvent *event) -{ - emit dropModeUpdate(event->mimeData()->hasUrls()); +void PluginListView::dragEnterEvent(QDragEnterEvent* event) { + emit dropModeUpdate(event->mimeData()->hasUrls()); - QTreeView::dragEnterEvent(event); + QTreeView::dragEnterEvent(event); } -void PluginListView::setModel(QAbstractItemModel *model) -{ - QTreeView::setModel(model); - setVerticalScrollBar(new ViewMarkingScrollBar(model, this)); +void PluginListView::setModel(QAbstractItemModel* model) { + QTreeView::setModel(model); + setVerticalScrollBar(new ViewMarkingScrollBar(model, this)); } #pragma once |
