Fix Ribble in mirrored layouts

This commit is contained in:
Clemens Manert 2023-02-11 23:14:29 +01:00
parent 84d662979d
commit 4c1f60eb1c
No known key found for this signature in database
GPG Key ID: 9197EAE8F85E3A18

View File

@ -29,15 +29,7 @@ QRectF QskRadioBoxSkinlet::subControlRect( const QskSkinnable* skinnable,
auto radio = static_cast<const QskRadioBox*>( skinnable );
if( subcontrol == Q::Ripple ) {
auto result = contentsRect;
auto lh = lineHeight( radio );
auto spacing = radio->spacingHint(Q::Panel);
result.setSize( radio->strutSizeHint( subcontrol ) );
result.moveTop( (lh + spacing) * radio->focusedIndex()
- (result.size().height() - lh ) / 2);
result.moveLeft(( radio->strutSizeHint( Q::Button ).width()
- result.width()) /2);
return result;
return buttonRect(radio, Q::Ripple, contentsRect, radio->focusedIndex());
}
return contentsRect;
@ -124,11 +116,13 @@ QRectF QskRadioBoxSkinlet::buttonRect( const QskRadioBox* radio,
result.moveTop( ( lineHeight( radio ) + spacing ) * index
+ (lineHeight(radio) - result.size().height()) / 2);
auto maxWidth = qMax(radio->strutSizeHint( Q::Button ).width(),
radio->strutSizeHint( Q::Symbol ).width());
if( radio->layoutMirroring() ) {
result.moveRight( rect.width() );
result.moveRight( rect.width() - (maxWidth - result.width())/2);
} else {
result.moveLeft((radio->strutSizeHint( Q::Button ).width()
- result.width()) / 2);
result.moveLeft((maxWidth - result.width()) / 2);
}
return result;