diff options
| author | Akseli Lahtinen <[email protected]> | 2025-03-03 14:02:20 +0200 |
|---|---|---|
| committer | Akseli Lahtinen <[email protected]> | 2025-03-04 16:55:48 +0000 |
| commit | d01d6ca476ce89cab3c3cc2ee50d242c74789cb4 (patch) | |
| tree | 14b39d6531ed012be15797e4fa6448e5094e2007 /src/statusbar | |
| parent | a1cea477c22e43079986e7204a61c5df385427ee (diff) | |
dolphinstatusbar: Fix negative value warnings with small statusbar fixedwidth
During splitview animations the parentWidget()->width could be lower
than scrollbarWidth. If it goes to negatives it causes a lot of
warnings.
Make sure to bound the value between 0 and parentWidget()->width() so
that it can't go into negatives.
Diffstat (limited to 'src/statusbar')
| -rw-r--r-- | src/statusbar/dolphinstatusbar.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp index e9773cb69..4d76afcbe 100644 --- a/src/statusbar/dolphinstatusbar.cpp +++ b/src/statusbar/dolphinstatusbar.cpp @@ -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. |
