You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/iBase/iPlugin/ZxTabWidget.h

97 lines
1.8 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <QMap>
#include <QTabWidget>
#include "iPlugin_global.h"
enum TabCloseMode
{
// pTabWx->setTabsClosable(true); //20171013
TCM_None = 0, //Tab页面不显示关闭按钮
TCM_Current, //只要当前激活的才显示
TCM_All //Tab所有页面显示关闭按钮
};
// 为了显示隐藏,临时
class TabItemInfo
{
public:
TabItemInfo()
{
m_sName = "";
m_nIndex = -1;
m_oIcon = QIcon();
m_sToolTip = "";
m_sWhatThis = "";
}
QString m_sName;
int m_nIndex;
QIcon m_oIcon;
QString m_sToolTip;
QString m_sWhatThis;
};
// ZxTabWidget该类实现TabWidget相关附加功能
class I_PLUGIN_EXPORT ZxTabWidget :
public QTabWidget
{
Q_OBJECT
public:
ZxTabWidget(QWidget *parent = 0);
~ZxTabWidget();
// 关闭按钮模式
void setTabCloseMode(TabCloseMode o);
TabCloseMode isTabCloseMode();
// Tab是否允许移动默认不移动
void setTabMovable(bool b);
bool isTabMovable();
// TabBar
QTabBar* getTabBar();
void setTabBarHorW(int n);
int getTabBarHorW();
// 显示/隐藏选项
void setTabItemVisible(int n, bool bVisible);
bool isTabItemVisible(int n);
void makesureCachedInfos();
protected slots:
void slotFreshButton(int n);
void slotCloseCurTab();
protected:
// virtual void mouseDoubleClickEvent(QMouseEvent *);
// event分发
virtual bool eventFilter(QObject *, QEvent *);
signals:
// 双击Item
void sigItemDoubleClicked(int n);
// 右击Item
void sigItemRightClicked(int n, QPoint pos);
protected:
QTabBar* m_pTabBar;
bool m_bTabMovable; //TabItem允许移动
TabCloseMode m_oTcm;//关闭按钮显示模式
// 为了显示隐藏,临时
QMap<QWidget*, TabItemInfo> m_pCachedInfos;
};