48 lines
832 B
C++
48 lines
832 B
C++
#ifndef CUSTOMTAB_H
|
|
#define CUSTOMTAB_H
|
|
|
|
#include <QFrame>
|
|
|
|
class QLabel;
|
|
class QBoxLayout;
|
|
class CustomTab : public QFrame
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
CustomTab(QWidget *parent = nullptr);
|
|
virtual ~CustomTab();
|
|
|
|
void setActive(bool);
|
|
|
|
void setText(const QString&);
|
|
QString text();
|
|
|
|
void setIcon(const QIcon&);
|
|
|
|
void setTabBar(const QString);
|
|
QString tabBar();
|
|
|
|
signals:
|
|
void clicked();
|
|
|
|
protected:
|
|
void mousePressEvent(QMouseEvent*);
|
|
void mouseMoveEvent(QMouseEvent*);
|
|
void mouseReleaseEvent(QMouseEvent*);
|
|
|
|
private:
|
|
QIcon m_Icon;
|
|
QSize m_IconSize;
|
|
QLabel* m_pIconLabel;
|
|
QLabel* m_pTitle;
|
|
QBoxLayout* m_pLayout;
|
|
QString m_strTabBar; //所在的tabBar
|
|
|
|
QPoint m_pStartPos;
|
|
bool m_bLeftButtonPressed;
|
|
bool m_bDragging;
|
|
};
|
|
|
|
#endif
|