returning an empty rect for the separator behind the last segment
This commit is contained in:
parent
8ee9e8ed22
commit
44e264d472
@ -18,7 +18,8 @@
|
|||||||
QskSegmentedBarSkinlet::QskSegmentedBarSkinlet( QskSkin* skin )
|
QskSegmentedBarSkinlet::QskSegmentedBarSkinlet( QskSkin* skin )
|
||||||
: Inherited( skin )
|
: Inherited( skin )
|
||||||
{
|
{
|
||||||
setNodeRoles( { PanelRole, SegmentRole, SeparatorRole, CursorRole, TextRole, GraphicRole } );
|
setNodeRoles( { PanelRole, SegmentRole, SeparatorRole,
|
||||||
|
CursorRole, TextRole, GraphicRole } );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSegmentedBarSkinlet::~QskSegmentedBarSkinlet() = default;
|
QskSegmentedBarSkinlet::~QskSegmentedBarSkinlet() = default;
|
||||||
@ -104,6 +105,9 @@ QRectF QskSegmentedBarSkinlet::separatorRect(
|
|||||||
{
|
{
|
||||||
using Q = QskSegmentedBar;
|
using Q = QskSegmentedBar;
|
||||||
|
|
||||||
|
if( index == bar->count() - 1 )
|
||||||
|
return QRectF(); // no separator behind the last segment
|
||||||
|
|
||||||
auto rect = segmentRect( bar, contentsRect, index );
|
auto rect = segmentRect( bar, contentsRect, index );
|
||||||
|
|
||||||
auto sh = bar->sizeHint();
|
auto sh = bar->sizeHint();
|
||||||
@ -312,25 +316,11 @@ QSGNode* QskSegmentedBarSkinlet::updateSampleNode( const QskSkinnable* skinnable
|
|||||||
|
|
||||||
const auto rect = sampleRect( bar, bar->contentsRect(), subControl, index );
|
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 );
|
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 );
|
const auto alignment = bar->alignmentHint( subControl, Qt::AlignCenter );
|
||||||
|
|
||||||
if ( subControl == Q::Text )
|
if ( subControl == Q::Text )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user