buttonClicked signal added

This commit is contained in:
Uwe Rathmann 2021-02-19 12:31:00 +01:00
parent 763ac4a205
commit 5a19669f26
2 changed files with 16 additions and 0 deletions

View File

@ -448,6 +448,9 @@ int QskTabBar::insertTab( int index, QskTabButton* button )
m_data->connectButton( button, this, true ); m_data->connectButton( button, this, true );
connect( button, &QskAbstractButton::clicked,
this, &QskTabBar::handleButtonClick );
Q_EMIT countChanged( count() ); Q_EMIT countChanged( count() );
return index; 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 QskTabBar::effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const QskAspect::Subcontrol subControl ) const
{ {

View File

@ -98,6 +98,7 @@ class QSK_EXPORT QskTabBar : public QskBox
Q_SIGNALS: Q_SIGNALS:
void currentIndexChanged( int index ); void currentIndexChanged( int index );
void buttonClicked( int index );
void countChanged( int ); void countChanged( int );
void textOptionsChanged( const QskTextOptions& ); void textOptionsChanged( const QskTextOptions& );
void tabPositionChanged( Qsk::Position ); void tabPositionChanged( Qsk::Position );
@ -109,6 +110,7 @@ class QSK_EXPORT QskTabBar : public QskBox
private: private:
void adjustCurrentIndex(); void adjustCurrentIndex();
void handleButtonClick();
class PrivateData; class PrivateData;
std::unique_ptr< PrivateData > m_data; std::unique_ptr< PrivateData > m_data;