summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qtabwidget.cpp
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2012-06-28 21:04:54 +0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-13 19:28:31 +0200
commit252bad7c589e03d3e12df02354b00a84d8e3159a (patch)
tree9e572c1704028e4c0d343c63801f4a5d0e8a9627 /src/widgets/widgets/qtabwidget.cpp
parent91e86688fc119e1bb67fd40ab30101015ddb638b (diff)
Add useful signals to QTabBar and QTabWidget
In this patch we introduce tabBarClicked and tabBarDoubleClicked to get a finer grained information on the user interaction with the tab bar. Done-with: kevin.ottens@kdab.com Change-Id: I7be76a556ca09186e98f2e076fe2512d6c5e6773 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/widgets/widgets/qtabwidget.cpp')
-rw-r--r--src/widgets/widgets/qtabwidget.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp
index 4df55e2537..9d14c01490 100644
--- a/src/widgets/widgets/qtabwidget.cpp
+++ b/src/widgets/widgets/qtabwidget.cpp
@@ -172,6 +172,26 @@ QT_BEGIN_NAMESPACE
\sa setTabsClosable()
*/
+/*!
+ \fn void QTabWidget::tabBarClicked(int index)
+
+ This signal is emitted when user clicks on a tab at an \a index.
+
+ \a index refers to the tab clicked, or -1 if no tab is under the cursor.
+
+ \since 5.2
+*/
+
+/*!
+ \fn void QTabWidget::tabBarDoubleClicked(int index)
+
+ This signal is emitted when the user double clicks on a tab at an \a index.
+
+ \a index is the index of a clicked tab, or -1 if no tab is under the cursor.
+
+ \since 5.2
+*/
+
class QTabWidgetPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QTabWidget)
@@ -693,6 +713,10 @@ void QTabWidget::setTabBar(QTabBar* tb)
this, SLOT(_q_showTab(int)));
connect(d->tabs, SIGNAL(tabMoved(int,int)),
this, SLOT(_q_tabMoved(int,int)));
+ connect(d->tabs, SIGNAL(tabBarClicked(int)),
+ this, SIGNAL(tabBarClicked(int)));
+ connect(d->tabs, SIGNAL(tabBarDoubleClicked(int)),
+ this, SIGNAL(tabBarDoubleClicked(int)));
if (d->tabs->tabsClosable())
connect(d->tabs, SIGNAL(tabCloseRequested(int)),
this, SIGNAL(tabCloseRequested(int)));