1 /* This file is (c) 2012 Tvangeste <i.4m.l33t@yandex.ru> 2 * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ 3 4 #ifndef MAINTABWIDGET_HH 5 #define MAINTABWIDGET_HH 6 7 #include <QTabWidget> 8 #include <QTabBar> 9 10 /// An extension of QTabWidget that allows to better control 11 /// the tabbar visibility. 12 class MainTabWidget: public QTabWidget 13 { 14 Q_OBJECT 15 Q_PROPERTY(bool hideSingleTab READ isHideSingleTab WRITE setHideSingleTab) 16 17 public: 18 MainTabWidget( QWidget * parent = 0 ); 19 isHideSingleTab() const20 bool isHideSingleTab() const { return hideSingleTab; } 21 void setHideSingleTab(bool hide); 22 23 signals: 24 void doubleClicked(); 25 26 protected: 27 // virtual void mouseDoubleClickEvent ( QMouseEvent * event ); 28 29 private: 30 virtual void tabInserted(int index); 31 virtual void tabRemoved(int index); 32 void updateTabBarVisibility(); 33 virtual bool eventFilter( QObject * obj, QEvent * ev ); 34 35 bool hideSingleTab; 36 }; 37 38 #endif // MAINTABWIDGET_HH 39