class MyTabWidget : public QTabWidget
{
Q_OBJECT
public:
MyTabWidget(QWidget *parent = 0) : QTabWidget(parent)
{
tabBar()->installEventFilter(this);
}
signals:
void tabBarDoubleClicked();
protected:
bool eventFilter(QObject *o, QEvent *e)
{
if (o != tabBar())
return false;
if (e->type() == QEvent::MouseButtonDblClick) {
QMouseEvent *me = static_cast<QMouseEvent *>(e);
if (tabBar()->tabAt(me->pos()) == -1)
emit tabBarDoubleClicked();
return true;
}
return false;
}
};