segmented bar: Fix vertical orientation
This commit is contained in:
parent
1b6f3285dc
commit
afdfa7b24e
@ -16,19 +16,6 @@
|
|||||||
#include <qfontmetrics.h>
|
#include <qfontmetrics.h>
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
|
|
||||||
static inline Qt::Orientation qskOrientation( const QskSegmentedBar* bar )
|
|
||||||
{
|
|
||||||
// For the moment we only handle the orientation TODO ...
|
|
||||||
|
|
||||||
const auto direction = bar->flagHint(
|
|
||||||
QskSegmentedBar::Panel | QskAspect::Direction, Qsk::LeftToRight );
|
|
||||||
|
|
||||||
if ( direction == Qsk::LeftToRight || direction == Qsk::RightToLeft )
|
|
||||||
return Qt::Horizontal;
|
|
||||||
else
|
|
||||||
return Qt::Vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
QskGraphic graphicAt( const QskSegmentedBar* bar, const int index )
|
QskGraphic graphicAt( const QskSegmentedBar* bar, const int index )
|
||||||
@ -48,7 +35,7 @@ namespace
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LayoutEngine( const QskSegmentedBar* bar, int index )
|
LayoutEngine( const QskSegmentedBar* bar, int index )
|
||||||
: QskSubcontrolLayoutEngine( qskOrientation( bar ) )
|
: QskSubcontrolLayoutEngine( bar->orientation() )
|
||||||
{
|
{
|
||||||
setSpacing( bar->spacingHint( QskSegmentedBar::Panel ) );
|
setSpacing( bar->spacingHint( QskSegmentedBar::Panel ) );
|
||||||
|
|
||||||
@ -56,8 +43,11 @@ namespace
|
|||||||
QskSegmentedBar::Text, bar->textAt( index ),
|
QskSegmentedBar::Text, bar->textAt( index ),
|
||||||
QskSegmentedBar::Graphic, graphicAt( bar, index ).defaultSize() );
|
QskSegmentedBar::Graphic, graphicAt( bar, index ).defaultSize() );
|
||||||
|
|
||||||
const auto alignment = bar->alignmentHint( QskSegmentedBar::Panel, Qt::AlignCenter );
|
if( bar->orientation() == Qt::Horizontal )
|
||||||
setFixedContent( QskSegmentedBar::Text, Qt::Horizontal, alignment );
|
{
|
||||||
|
const auto alignment = bar->alignmentHint( QskSegmentedBar::Panel, Qt::AlignCenter );
|
||||||
|
setFixedContent( QskSegmentedBar::Text, Qt::Horizontal, alignment );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ void QskSubcontrolLayoutEngine::setGraphicTextElements( const QskSkinnable* skin
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
graphicElement->setSizePolicy( SP::Fixed, SP::Fixed );
|
graphicElement->setSizePolicy( SP::Preferred, SP::Fixed );
|
||||||
textElement->setSizePolicy( SP::Preferred, SP::Constrained );
|
textElement->setSizePolicy( SP::Preferred, SP::Constrained );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user