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.

81 lines
2.2 KiB
C

#ifndef SARIBBONCONTEXTCATEGORY_H
#define SARIBBONCONTEXTCATEGORY_H
#include "SARibbonGlobal.h"
#include "SARibbonCategory.h"
#include <QWidget>
/**
* @brief
*/
class SA_RIBBON_EXPORT SARibbonContextCategory : public QObject
{
Q_OBJECT
SA_RIBBON_DECLARE_PRIVATE(SARibbonContextCategory)
public:
SARibbonContextCategory(QWidget* parent = 0);
~SARibbonContextCategory();
//上下文目录添加下属目录
SARibbonCategory* addCategoryPage(const QString& title);
void addCategoryPage(SARibbonCategory* category);
//获取上下文标签下管理的标签个数
int categoryCount() const;
//设置id
void setId(const QVariant& id);
QVariant id() const;
//设置上下文颜色
void setContextColor(const QColor color);
QColor contextColor() const;
//上下文标签的内容
QString contextTitle() const;
void setContextTitle(const QString& contextTitle);
//获取对应的tab页
SARibbonCategory* categoryPage(int index);
//获取所有的SARibbonCategory*
QList< SARibbonCategory* > categoryList() const;
//移除category
bool takeCategory(SARibbonCategory* category);
//判断上下文是否维护了此SARibbonCategory
bool isHaveCategory(SARibbonCategory* category) const;
signals:
/**
* @brief
* @param category
*/
void categoryPageAdded(SARibbonCategory* category);
/**
* @brief
* @param category
*/
void categoryPageRemoved(SARibbonCategory* category);
/**
* @brief
* @param title
*/
void contextTitleChanged(const QString& title);
/**
* @brief
* @param category
* @param title
*/
void categoryTitleChanged(SARibbonCategory* category, const QString& title);
private slots:
void onCategoryTitleChanged(const QString& title);
protected:
//获取父级窗口
QWidget* parentWidget() const;
virtual bool eventFilter(QObject* watched, QEvent* e) override;
};
#endif // SARIBBONCONTEXTCATEGORY_H