segmented bar: Always assume 0 spacing between elements

... as is in the nature of this control. Rather think of the spacing
as the space between the icon and the text, like we do with
QskPushButton.
This commit is contained in:
Peter Hartmann 2023-01-27 15:17:17 +01:00 committed by uwerat
parent f8983afa17
commit 329531777a

View File

@ -77,23 +77,22 @@ QRectF QskSegmentedBarSkinlet::segmentRect(
{ {
using Q = QskSegmentedBar; using Q = QskSegmentedBar;
const auto spacing = bar->spacingHint( Q::Panel );
const auto count = bar->count(); const auto count = bar->count();
auto rect = subControlRect( bar, contentsRect, Q::Panel ); auto rect = subControlRect( bar, contentsRect, Q::Panel );
if( bar->orientation() == Qt::Horizontal ) if( bar->orientation() == Qt::Horizontal )
{ {
const qreal w = ( rect.width() - ( count - 1 ) * spacing ) / count; const qreal w = rect.width() / count;
rect.setLeft( index * ( w + spacing ) ); rect.setLeft( index * w );
rect.setWidth( w ); rect.setWidth( w );
} }
else else
{ {
const qreal h = ( rect.height() - ( count - 1 ) * spacing ) / count; const qreal h = rect.height() / count;
rect.setTop( index * ( h + spacing ) ); rect.setTop( index * h );
rect.setHeight( h ); rect.setHeight( h );
} }