From 44e264d4725e4730d44ce47a41d804b5fc4dcb41 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 27 Jun 2022 13:44:44 +0200 Subject: [PATCH] returning an empty rect for the separator behind the last segment --- src/controls/QskSegmentedBarSkinlet.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) 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 )