diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-12-31 17:53:45 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 15:38:18 +0100 |
| commit | cc4dcf617fbad6783b74b4df0963911a149ffaf1 (patch) | |
| tree | 9f79796ac1657c9e3f6d9708c7ddd7bad7e43b16 /src/moapplication.cpp | |
| parent | ac6373edf677aba5a2add70f41e373e678c567ba (diff) | |
Move modlistview proxy style to moapplication.
Diffstat (limited to 'src/moapplication.cpp')
| -rw-r--r-- | src/moapplication.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/moapplication.cpp b/src/moapplication.cpp index fb6a7121..9b261a45 100644 --- a/src/moapplication.cpp +++ b/src/moapplication.cpp @@ -65,6 +65,13 @@ public: void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const {
if(element == QStyle::PE_IndicatorItemViewItemDrop) {
+
+ QRect rect(option->rect);
+ if (auto* view = qobject_cast<const QTreeView*>(widget)) {
+ rect.setLeft(view->indentation());
+ rect.setRight(widget->width());
+ }
+
painter->setRenderHint(QPainter::Antialiasing, true);
QColor col(option->palette.windowText().color());
@@ -75,16 +82,16 @@ public: painter->setPen(pen);
painter->setBrush(brush);
- if(option->rect.height() == 0) {
+ if(rect.height() == 0) {
QPoint tri[3] = {
- option->rect.topLeft(),
- option->rect.topLeft() + QPoint(-5, 5),
- option->rect.topLeft() + QPoint(-5, -5)
+ rect.topLeft(),
+ rect.topLeft() + QPoint(-5, 5),
+ rect.topLeft() + QPoint(-5, -5)
};
painter->drawPolygon(tri, 3);
- painter->drawLine(QPoint(option->rect.topLeft().x(), option->rect.topLeft().y()), option->rect.topRight());
+ painter->drawLine(QPoint(rect.topLeft().x(), rect.topLeft().y()), rect.topRight());
} else {
- painter->drawRoundedRect(option->rect, 5, 5);
+ painter->drawRoundedRect(rect, 5, 5);
}
} else {
QProxyStyle::drawPrimitive(element, option, painter, widget);
|
