initial tabbar position as skin hint ( QskTabBar::Panel | QskAspect::Style )
This commit is contained in:
parent
ff7cb37edc
commit
4ef3fe3164
@ -41,7 +41,6 @@ namespace
|
|||||||
TabView( QQuickItem* parent = nullptr )
|
TabView( QQuickItem* parent = nullptr )
|
||||||
: QskTabView( parent )
|
: QskTabView( parent )
|
||||||
{
|
{
|
||||||
setTabBarEdge( Qt::BottomEdge );
|
|
||||||
setAutoFitTabs( true );
|
setAutoFitTabs( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,6 +712,8 @@ void Editor::setupTabBar()
|
|||||||
setGradient( Q::Panel, m_pal.secondaryContainer );
|
setGradient( Q::Panel, m_pal.secondaryContainer );
|
||||||
setPadding( Q::Panel, 0 );
|
setPadding( Q::Panel, 0 );
|
||||||
|
|
||||||
|
setFlagHint( Q::Panel | A::Style, Qt::BottomEdge );
|
||||||
|
|
||||||
// when flicking
|
// when flicking
|
||||||
setAnimation( Q::Panel | A::Metric, QskAnimationHint( 200, QEasingCurve::InCubic ) );
|
setAnimation( Q::Panel | A::Metric, QskAnimationHint( 200, QEasingCurve::InCubic ) );
|
||||||
}
|
}
|
||||||
|
@ -250,11 +250,6 @@ namespace
|
|||||||
class QskTabBar::PrivateData
|
class QskTabBar::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PrivateData( Qt::Edge edge )
|
|
||||||
: edge( edge )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void connectButton( QskTabButton* button, QskTabBar* tabBar, bool on )
|
void connectButton( QskTabButton* button, QskTabBar* tabBar, bool on )
|
||||||
{
|
{
|
||||||
if ( on )
|
if ( on )
|
||||||
@ -274,21 +269,15 @@ class QskTabBar::PrivateData
|
|||||||
int currentIndex = -1;
|
int currentIndex = -1;
|
||||||
|
|
||||||
QskTextOptions textOptions;
|
QskTextOptions textOptions;
|
||||||
Qt::Edge edge;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QskTabBar::QskTabBar( QQuickItem* parent )
|
QskTabBar::QskTabBar( QQuickItem* parent )
|
||||||
: QskTabBar( Qt::TopEdge, parent )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QskTabBar::QskTabBar( Qt::Edge edge, QQuickItem* parent )
|
|
||||||
: Inherited( parent )
|
: Inherited( parent )
|
||||||
, m_data( new PrivateData( edge ) )
|
, m_data( new PrivateData() )
|
||||||
{
|
{
|
||||||
setAutoLayoutChildren( true );
|
setAutoLayoutChildren( true );
|
||||||
|
|
||||||
const auto orientation = qskOrientation( edge );
|
const auto orientation = qskOrientation( edge() );
|
||||||
|
|
||||||
if ( orientation == Qt::Horizontal )
|
if ( orientation == Qt::Horizontal )
|
||||||
initSizePolicy( QskSizePolicy::Preferred, QskSizePolicy::Fixed );
|
initSizePolicy( QskSizePolicy::Preferred, QskSizePolicy::Fixed );
|
||||||
@ -306,16 +295,24 @@ QskTabBar::QskTabBar( Qt::Edge edge, QQuickItem* parent )
|
|||||||
m_data->buttonBox, &ButtonBox::restack, Qt::QueuedConnection );
|
m_data->buttonBox, &ButtonBox::restack, Qt::QueuedConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QskTabBar::QskTabBar( Qt::Edge edge, QQuickItem* parent )
|
||||||
|
: QskTabBar( parent )
|
||||||
|
{
|
||||||
|
setEdge( edge );
|
||||||
|
}
|
||||||
|
|
||||||
QskTabBar::~QskTabBar()
|
QskTabBar::~QskTabBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTabBar::setEdge( Qt::Edge edge )
|
void QskTabBar::setEdge( Qt::Edge edge )
|
||||||
{
|
{
|
||||||
if ( edge == m_data->edge )
|
const auto oldEdge = this->edge();
|
||||||
return;
|
|
||||||
|
|
||||||
m_data->edge = edge;
|
setFlagHint( Panel | QskAspect::Style, edge );
|
||||||
|
|
||||||
|
if ( edge == oldEdge )
|
||||||
|
return;
|
||||||
|
|
||||||
const auto orientation = qskOrientation( edge );
|
const auto orientation = qskOrientation( edge );
|
||||||
|
|
||||||
@ -337,14 +334,25 @@ void QskTabBar::setEdge( Qt::Edge edge )
|
|||||||
Q_EMIT edgeChanged( edge );
|
Q_EMIT edgeChanged( edge );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskTabBar::resetEdge()
|
||||||
|
{
|
||||||
|
if ( resetFlagHint( Panel | QskAspect::Style ) )
|
||||||
|
Q_EMIT edgeChanged( edge() );
|
||||||
|
}
|
||||||
|
|
||||||
Qt::Edge QskTabBar::edge() const
|
Qt::Edge QskTabBar::edge() const
|
||||||
{
|
{
|
||||||
return m_data->edge;
|
/*
|
||||||
|
We add a meaningless QskAspect::Vertical bit to avoid that effectivePlacement
|
||||||
|
gets called finally ending up in an endless recursion ...
|
||||||
|
*/
|
||||||
|
const auto aspect = Panel | QskAspect::Style | QskAspect::Vertical;
|
||||||
|
return flagHint< Qt::Edge > ( aspect, Qt::TopEdge );
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Orientation QskTabBar::orientation() const
|
Qt::Orientation QskTabBar::orientation() const
|
||||||
{
|
{
|
||||||
return qskOrientation( m_data->edge );
|
return qskOrientation( edge() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTabBar::setAutoScrollFocusedButton( bool on )
|
void QskTabBar::setAutoScrollFocusedButton( bool on )
|
||||||
@ -363,7 +371,7 @@ bool QskTabBar::autoScrollFocusButton() const
|
|||||||
|
|
||||||
void QskTabBar::setAutoFitTabs( bool on )
|
void QskTabBar::setAutoFitTabs( bool on )
|
||||||
{
|
{
|
||||||
const auto orientation = qskOrientation( m_data->edge );
|
const auto orientation = qskOrientation( edge() );
|
||||||
int policy = m_data->buttonBox->sizePolicy( orientation );
|
int policy = m_data->buttonBox->sizePolicy( orientation );
|
||||||
|
|
||||||
if ( ( policy & QskSizePolicy::GrowFlag ) != on )
|
if ( ( policy & QskSizePolicy::GrowFlag ) != on )
|
||||||
@ -682,7 +690,7 @@ QskAspect::Subcontrol QskTabBar::substitutedSubcontrol(
|
|||||||
|
|
||||||
QskAspect::Placement QskTabBar::effectivePlacement() const
|
QskAspect::Placement QskTabBar::effectivePlacement() const
|
||||||
{
|
{
|
||||||
switch ( m_data->edge )
|
switch ( edge() )
|
||||||
{
|
{
|
||||||
case Qt::LeftEdge:
|
case Qt::LeftEdge:
|
||||||
return QskAspect::Left;
|
return QskAspect::Left;
|
||||||
|
@ -16,7 +16,8 @@ class QSK_EXPORT QskTabBar : public QskBox
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY( Qt::Edge edge READ edge WRITE setEdge NOTIFY edgeChanged FINAL )
|
Q_PROPERTY( Qt::Edge edge READ edge
|
||||||
|
WRITE setEdge RESET resetEdge NOTIFY edgeChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( Qt::Orientation orientation READ orientation )
|
Q_PROPERTY( Qt::Orientation orientation READ orientation )
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ class QSK_EXPORT QskTabBar : public QskBox
|
|||||||
~QskTabBar() override;
|
~QskTabBar() override;
|
||||||
|
|
||||||
void setEdge( Qt::Edge );
|
void setEdge( Qt::Edge );
|
||||||
|
void resetEdge();
|
||||||
Qt::Edge edge() const;
|
Qt::Edge edge() const;
|
||||||
|
|
||||||
Qt::Orientation orientation() const;
|
Qt::Orientation orientation() const;
|
||||||
|
@ -34,7 +34,7 @@ QskTabView::QskTabView( QQuickItem* parent )
|
|||||||
{
|
{
|
||||||
setPolishOnResize( true );
|
setPolishOnResize( true );
|
||||||
|
|
||||||
m_data->tabBar = new QskTabBar( Qt::TopEdge, this );
|
m_data->tabBar = new QskTabBar( this );
|
||||||
|
|
||||||
m_data->stackBox = new QskStackBox( this );
|
m_data->stackBox = new QskStackBox( this );
|
||||||
m_data->stackBox->setObjectName( QStringLiteral( "QskTabViewStackBox" ) );
|
m_data->stackBox->setObjectName( QStringLiteral( "QskTabViewStackBox" ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user