diff --git a/src/controls/QskTabBar.cpp b/src/controls/QskTabBar.cpp index cfd363d1..684914b2 100644 --- a/src/controls/QskTabBar.cpp +++ b/src/controls/QskTabBar.cpp @@ -448,6 +448,9 @@ int QskTabBar::insertTab( int index, QskTabButton* button ) m_data->connectButton( button, this, true ); + connect( button, &QskAbstractButton::clicked, + this, &QskTabBar::handleButtonClick ); + Q_EMIT countChanged( count() ); return index; @@ -657,6 +660,17 @@ void QskTabBar::adjustCurrentIndex() } } +void QskTabBar::handleButtonClick() +{ + if ( auto button = qobject_cast< const QskTabButton* >( sender() ) ) + { + const auto index = indexOf( button ); + + if ( index >= 0 ) + Q_EMIT buttonClicked( index ); + } +} + QskAspect::Subcontrol QskTabBar::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const { diff --git a/src/controls/QskTabBar.h b/src/controls/QskTabBar.h index a93dc53a..14a4dd94 100644 --- a/src/controls/QskTabBar.h +++ b/src/controls/QskTabBar.h @@ -98,6 +98,7 @@ class QSK_EXPORT QskTabBar : public QskBox Q_SIGNALS: void currentIndexChanged( int index ); + void buttonClicked( int index ); void countChanged( int ); void textOptionsChanged( const QskTextOptions& ); void tabPositionChanged( Qsk::Position ); @@ -109,6 +110,7 @@ class QSK_EXPORT QskTabBar : public QskBox private: void adjustCurrentIndex(); + void handleButtonClick(); class PrivateData; std::unique_ptr< PrivateData > m_data;