diff options
Diffstat (limited to 'kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch')
-rw-r--r-- | kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch b/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch new file mode 100644 index 000000000000..b8b3504a0a0e --- /dev/null +++ b/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch @@ -0,0 +1,76 @@ +From 53f24305536850b244b730f9a04024daf02e753b Mon Sep 17 00:00:00 2001 +From: Jan Blackquill <uhhadd@gmail.com> +Date: Fri, 3 Jun 2022 17:34:02 -0400 +Subject: [PATCH] kstyle: fix qqc2 desktop style sliders in RtL + +We don't do any mirroring of the slider groove rects or tickmarks based on layout direction, +and this causes qqc2-desktop-style sliders to render in the wrong direction. +Swapping the leftRect and the rightRect when option->direction == Qt::RightToLeft +fixes this. + +This wasn't broken with QWidgets because QSlider relies on (ab)using the upsideDown option +in order to achieve mirroring of the groove instead of option->direction, and consequently, +this change doesn't affect Qt widgets apps at all. + +BUG: 430101 +(cherry picked from commit e8b1d4aa47daf99041332f43c29fabdf70f25004) + +* asturm 2022-07-26: Merged with clang-format changes in commit + 32149dc002ae574ed41f111bf52712b1765b906b + +--- + kstyle/breezestyle.cpp | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp +index 2ef2ea98..c9fba292 100644 +--- a/kstyle/breezestyle.cpp ++++ b/kstyle/breezestyle.cpp +@@ -51,6 +51,7 @@ + #include <QDialogButtonBox> + #include <QGraphicsItem> + #include <QGraphicsProxyWidget> ++#include <qnamespace.h> + + #if BREEZE_HAVE_QTQUICK + #include <QQuickWindow> +@@ -6679,6 +6680,7 @@ namespace Breeze + } + + // colors ++ const auto reverseTicks = option->direction == Qt::LeftToRight ? upsideDown : !upsideDown; + const auto base( _helper->separatorColor( palette ) ); + const auto &highlight = hasHighlightNeutral( widget, option, mouseOver, hasFocus ) ? _helper->neutralText( palette ) : palette.color( QPalette::Highlight ); + +@@ -6693,8 +6695,8 @@ namespace Breeze + int position( sliderPositionFromValue( sliderOption->minimum, sliderOption->maximum, current, available ) + fudge ); + foreach( const QLine& tickLine, tickLines ) + { +- if( horizontal ) painter->drawLine( tickLine.translated( upsideDown ? (rect.width() - position) : position, 0 ) ); +- else painter->drawLine( tickLine.translated( 0, upsideDown ? (rect.height() - position):position ) ); ++ if( horizontal ) painter->drawLine(tickLine.translated(reverseTicks ? (rect.width() - position) : position, 0)); ++ else painter->drawLine(tickLine.translated(0, reverseTicks ? (rect.height() - position) : position)); + } + + // go to next position +@@ -6729,11 +6731,15 @@ namespace Breeze + + auto leftRect( grooveRect ); + leftRect.setRight( handleRect.right() - Metrics::Slider_ControlThickness/2 ); +- _helper->renderSliderGroove( painter, leftRect, upsideDown ? grooveColor:highlight ); + + auto rightRect( grooveRect ); + rightRect.setLeft( handleRect.left() + Metrics::Slider_ControlThickness/2 ); +- _helper->renderSliderGroove( painter, rightRect, upsideDown ? highlight:grooveColor ); ++ ++ if (option->direction == Qt::RightToLeft) ++ std::swap(leftRect, rightRect); ++ ++ _helper->renderSliderGroove(painter, leftRect, upsideDown ? grooveColor : highlight); ++ _helper->renderSliderGroove(painter, rightRect, upsideDown ? highlight : grooveColor); + + } else { + +-- +2.35.1 + |