]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/statusbar/dolphinstatusbar.cpp
dolphinstatusbar: Fix negative value warnings with small statusbar fixedwidth
[dolphin.git] / src / statusbar / dolphinstatusbar.cpp
index e9773cb696f0f1afe1bc97de5db839218baa91b4..4d76afcbe6530f66e9c646f6e974919c5524a862 100644 (file)
@@ -285,7 +285,8 @@ void DolphinStatusBar::updateWidthToContent()
         // Make sure minimum height takes clipping into account.
         setMinimumHeight(m_label->height() + clippingAmount());
         const int scrollbarWidth = style()->pixelMetric(QStyle::PM_ScrollBarExtent, &opt, this);
-        const int maximumViewWidth = parentWidget()->width() - scrollbarWidth;
+        // Make sure maximumViewWidth does not go below 0.
+        const int maximumViewWidth = qMax(0, parentWidget()->width() - scrollbarWidth);
         if (m_stopButton->isVisible() || m_progressTextLabel->isVisible() || m_progressBar->isVisible()) {
             // Use maximum width when interactable elements are shown, to keep them
             // from "jumping around" when user tries to interact with them.