logplus/Workflow/WFWidget/include/PaiToolBarView.h
2026-01-17 12:55:45 +08:00

111 lines
2.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file PaiToolBarView.h
* @brief P.A.I 风格工具栏,默认包含一个工具栏,并且不能被删除
* @date 2011-09-16
*/
#ifndef PAI_FRAME_WIDGET_PAITOOLBARVIEW_H
#define PAI_FRAME_WIDGET_PAITOOLBARVIEW_H
#include <QWidget>
#include "Turtle.h"
class QVBoxLayout;
class QToolBar;
namespace pai
{
/**
* @class PaiToolBarView
* @brief P.A.I 风格工具栏,默认包含一个工具栏,并且不能被删除
*/
class PAI_WIDGET_EXPORT PaiToolBarView : public QWidget
{
public:
/**
* @enum EToolBarType
* @brief 风格
*/
enum EToolBarType
{
NORMAL_TOOLBAR = 40, ///< 普通风格
SMALL_TOOLBAR = 28 ///< 小模式ToolBar
};
/**
* @brief 构造函数
* @param[in] pParent 父窗口句柄
* @param[in] type 风格类型
*/
PaiToolBarView(QWidget *pParent = NULL, EToolBarType type = NORMAL_TOOLBAR);
/**
* @brief 析构函数
*/
virtual ~PaiToolBarView();
/**
* @brief 获得视口
* @return 视口
*/
QWidget* GetViewport();
/**
* @brief 重新设置一个视口原视口会被清楚新视口的的parent将会视为这个类的对象
* @param[in] pWidget 视口组件
*/
void SetViewport(QWidget *pWidget);
/**
* @brief 添加一个新的工具栏
* @param[in] pToolBar 工具栏组件
* @param[in] type 风格类型
*/
void AddToolBar(QToolBar *pToolBar, EToolBarType type = NORMAL_TOOLBAR);
/**
* @brief 去掉指定的工具栏
* @param[in] pToolBar 工具栏组件
*/
void RemoveToolBar(QToolBar *pToolBar);
/**
* @brief 获得当前存在的工具栏指针序列
* @return 当前存在的工具栏指针序列
*/
QList<QToolBar*> GetToolBars();
/**
* @brief 向指定工具栏添加QAction如果工具栏未指定将会被添加到第一个工具栏
* @param[in] pAction action对象
* @param[in] pToolBar 工具栏组件
*/
void AddAction(QAction *pAction, QToolBar *pToolBar = NULL);
/**
* @brief 向指定工具栏添加QWidget如果工具栏未指定将会被添加到第一个工具栏
* @param[in] pWidget widget对象
* @param[in] pToolBar 工具栏组件
*/
void AddWidget(QWidget *pWidget, QToolBar *pToolBar = NULL);
/**
* @brief 添加一个ToolButton(这里toolbar有2个固定的值所以可以将toolbutton设置为固定的大小)
* @param[in] pToolButton toolbutton对象
* @param[in] pToolBar 工具栏组件
*/
void AddToolButton(QWidget *pToolButton, QToolBar *pToolBar = NULL);
private:
QWidget *m_pToolBarArea; ///< 工具栏区域
QWidget *m_pViewport; ///< 视图
QList<QToolBar*> m_ToolBars; ///< 工具栏
QVBoxLayout *m_pMainVLayout; ///< 主布局
QVBoxLayout *m_pToolBarLayout; ///< 工具栏布局
};
}
#endif ///< PAI_FRAME_WIDGET_PAITOOLBARVIEW_H