goldendict-ng/src/ui/maintabwidget.hh
shenleban tongying dd95690940
clean: simplify tabbar double click detect via qt's built-in methods (#1419)
* clean: simplify tabbar double click detect via qt's built-in methods

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-18 17:45:06 +08:00

36 lines
838 B
C++

/* This file is (c) 2012 Tvangeste <i.4m.l33t@yandex.ru>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef MAINTABWIDGET_HH
#define MAINTABWIDGET_HH
#include <QTabWidget>
#include <QTabBar>
/// An extension of QTabWidget that allows to better control
/// the tabbar visibility.
class MainTabWidget: public QTabWidget
{
Q_OBJECT
Q_PROPERTY( bool hideSingleTab READ isHideSingleTab WRITE setHideSingleTab )
public:
MainTabWidget( QWidget * parent = 0 );
bool isHideSingleTab() const
{
return hideSingleTab;
}
void setHideSingleTab( bool hide );
private:
virtual void tabInserted( int index );
virtual void tabRemoved( int index );
void updateTabBarVisibility();
virtual bool eventFilter( QObject * obj, QEvent * ev );
bool hideSingleTab;
};
#endif // MAINTABWIDGET_HH