76 lines
2.1 KiB
C++
76 lines
2.1 KiB
C++
/*
|
|
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 <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef ETABWIDGET_H
|
|
#define ETABWIDGET_H
|
|
|
|
#include <QTabWidget>
|
|
#include <QDebug>
|
|
#include <QTabBar>
|
|
#include <QMouseEvent>
|
|
#include <QEvent>
|
|
#include <QToolButton>
|
|
#include <QPushButton>
|
|
#include <QLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QApplication>
|
|
#include "qad_export.h"
|
|
|
|
|
|
class QAD_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 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<TabButton> buttons;
|
|
|
|
private slots:
|
|
void buttonClicked();
|
|
|
|
signals:
|
|
void countChanged();
|
|
void tabHovered(int tab);
|
|
void tabButtonClicked(int tab, int role);
|
|
|
|
};
|
|
|
|
#endif // ETABWIDGET_H
|