/* QAD - Qt ADvanced Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef ETABWIDGET_H #define ETABWIDGET_H #include "qad_application_export.h" #include #include #include #include #include #include #include #include #include #include class QAD_APPLICATION_EXPORT ETabWidget: public QTabWidget { Q_OBJECT public: explicit ETabWidget(QWidget * parent = 0); void retranslate(); void addTabButton(int role, const QIcon & icon, const QString & toolTip = QString()) { buttons << TabButton(role, icon, toolTip); } int addTab(QWidget * page, const QIcon & icon, const QString & label); int addTab(QWidget * page, const QString & label) { return addTab(page, QIcon(), label); } void setButtonVisible(int role, bool yes); private: bool eventFilter(QObject * o, QEvent * e); void tabInserted(int) { emit countChanged(); } void tabRemoved(int) { emit countChanged(); } void changeEvent(QEvent * e); struct QAD_APPLICATION_EXPORT TabButton { TabButton(int r, const QIcon & i, const QString & t) { role = r; icon = i; visible = true; srcToolTip = t; toolTip = QApplication::translate("MainWindow", t.toUtf8(), 0 /*, QCoreApplication::UnicodeUTF8*/); } int role; bool visible; QIcon icon; QString srcToolTip; QString toolTip; }; QList buttons; private slots: void buttonClicked(); signals: void countChanged(); void tabHovered(int tab); void tabButtonClicked(int tab, int role); }; #endif // ETABWIDGET_H