diff --git a/src/controls/QskSegmentedBarSkinlet.cpp b/src/controls/QskSegmentedBarSkinlet.cpp index b6f54789..93fd7484 100644 --- a/src/controls/QskSegmentedBarSkinlet.cpp +++ b/src/controls/QskSegmentedBarSkinlet.cpp @@ -18,7 +18,8 @@ QskSegmentedBarSkinlet::QskSegmentedBarSkinlet( QskSkin* skin ) : Inherited( skin ) { - setNodeRoles( { PanelRole, SegmentRole, SeparatorRole, CursorRole, TextRole, GraphicRole } ); + setNodeRoles( { PanelRole, SegmentRole, SeparatorRole, + CursorRole, TextRole, GraphicRole } ); } QskSegmentedBarSkinlet::~QskSegmentedBarSkinlet() = default; @@ -104,6 +105,9 @@ QRectF QskSegmentedBarSkinlet::separatorRect( { using Q = QskSegmentedBar; + if( index == bar->count() - 1 ) + return QRectF(); // no separator behind the last segment + auto rect = segmentRect( bar, contentsRect, index ); auto sh = bar->sizeHint(); @@ -312,25 +316,11 @@ QSGNode* QskSegmentedBarSkinlet::updateSampleNode( const QskSkinnable* skinnable const auto rect = sampleRect( bar, bar->contentsRect(), subControl, index ); - if ( subControl == Q::Segment ) + if ( subControl == Q::Segment || subControl == Q::Separator ) { return updateBoxNode( skinnable, node, rect, subControl ); } - if( subControl == Q::Separator ) - { - if( index == bar->count() - 1 ) - { - return nullptr; - } - else - { - const auto rect = sampleRect( bar, bar->contentsRect(), subControl, index ); - - return updateBoxNode( skinnable, node, rect, subControl ); - } - } - const auto alignment = bar->alignmentHint( subControl, Qt::AlignCenter ); if ( subControl == Q::Text )