diff options
| author | Brian Munro <brian.alexander.munro@gmail.com> | 2018-02-22 18:02:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-22 18:02:02 +0200 |
| commit | 28714f0eb800f2170acbf29dddce1582d20d6b8b (patch) | |
| tree | 0684c123db375336e0e03f0240155a12e744db16 /src/pluginlistview.cpp | |
| parent | 0bcd752b2758bdb072b498ccc90905276be065e9 (diff) | |
| parent | 5e5c9c07291f6b09623d31c92b1fb61c4ede576e (diff) | |
Merge pull request #236 from SuperSandro2000/new_vfs_library
Update reame.md
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 |
