]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DolphinStatusbar: Fix background and margins for non-Breeze styles
authorAkseli Lahtinen <akselmo@akselmo.dev>
Tue, 22 Apr 2025 13:52:50 +0000 (16:52 +0300)
committerAkseli Lahtinen <akselmo@akselmo.dev>
Tue, 22 Apr 2025 13:52:50 +0000 (16:52 +0300)
There is a bug where non-Breeze styles, such as fusion, do not always have
background color for the small statusbar.
There is also a bug that made the statusbar too small for other themes.

This patch makes us always draw a background, and uses marginLeft and marginRight from QStyle.

src/statusbar/dolphinstatusbar.cpp

index 4d76afcbe6530f66e9c646f6e974919c5524a862..17a29e84cdc296951c7a5fb2f45a5909a449ad9b 100644 (file)
@@ -292,7 +292,8 @@ void DolphinStatusBar::updateWidthToContent()
             // from "jumping around" when user tries to interact with them.
             setFixedWidth(maximumViewWidth);
         } else {
-            const int contentWidth = labelSize.width() + 15;
+            const int contentWidth = style()->pixelMetric(QStyle::PM_LayoutLeftMargin, &opt, this) + labelSize.width()
+                + style()->pixelMetric(QStyle::PM_LayoutRightMargin, &opt, this);
             setFixedWidth(qMin(contentWidth, maximumViewWidth));
         }
         Q_EMIT widthUpdated();
@@ -447,6 +448,9 @@ void DolphinStatusBar::paintEvent(QPaintEvent *paintEvent)
             path.addRect(clipRect);
             p.setClipPath(path);
             opt.palette.setColor(QPalette::Base, palette().window().color());
+            p.setBrush(palette().window().color());
+            p.setPen(Qt::transparent);
+            p.drawRoundedRect(opt.rect, 5, 5); // Radius is from Breeze style.
             style()->drawPrimitive(QStyle::PE_Frame, &opt, &p, this);
         }
     }