logplus/Workflow/WFWidget/include/PaiHeaderView.h

182 lines
5.5 KiB
C
Raw Normal View History

2026-01-17 12:55:45 +08:00
/**
* @file PaiHeaderView.h
* @brief PaiHeaderView P.A.I系统定制发布的表头控件
* @attention TableView使用过
*
*******************************************************************
* ENHANCEMENTS *
*******************************************************************
* 1.
* 2.
* @date 2012-01-11
*/
#ifndef PAI_FRAME_WIDGET_PAIHEADERVIEW_H
#define PAI_FRAME_WIDGET_PAIHEADERVIEW_H
#include <QHeaderView>
#include "Turtle.h"
class QToolButton;
class QCheckBox;
namespace pai
{
namespace gui
{
/**
* @class PaiHeaderView
* @brief PAI功能的表格标题栏
*/
class PAI_WIDGET_EXPORT PaiHeaderView: public QHeaderView
{
Q_OBJECT
public:
/**
* @brief
* @param[in] orientation
* @param[in] pParent
*/
PaiHeaderView(Qt::Orientation orientation, QWidget *pParent= NULL);
/**
* @brief
*/
virtual ~PaiHeaderView();
/**
* @brief
* @param[in] selectable
*/
void SetSectionVisibleSelectable(bool selectable);
/**
* @brief
* @param[in] sectionList
*/
void SetUnselectableSections(const QStringList & sectionList);
/**
* @brief PaiSettings记录
*/
void RecallMemberedSections();
/**
* @brief
*/
void RememberCurrentSections();
/**
* @brief ,CheckBox
* @param[in] logicalIndex
* @param[in] checkable
* @param[in] pCheckBox CheckBoxcheckable为false
*/
void SetColumnCheckable(const int logicalIndex, const bool checkable, QCheckBox *pCheckBox = NULL);
/**
* @brief CheckBox的位置
* @param[in] insert true表示插入操作fasle表示删除操作
* @param[in] column
*/
void AdjustCheckBoxMap(bool insert, int column);
protected:
/**
* @brief
* @param[in] pPainter
* @param[in] rect
* @param[in] logicalIndex
*/
void paintSection(QPainter *pPainter, const QRect & rect, int logicalIndex) const;
/**
* @brief 使
* @param[in] pEvent
*/
void resizeEvent(QResizeEvent *pEvent);
/**
* @brief
* @param[in] pEvent
*/
void mousePressEvent (QMouseEvent *pEvent);
private:
/**
* @brief
* @param[in] logicalIndex
* @return
*/
int SectionSuitableWidth(int logicalIndex);
/**
* @brief logical index
* @return
*/
int LastVisibleSection() const;
/**
* @brief If hide is true the section specified by logicalIndex is hidden; otherwise the section is shown
* @param[in] logicalIndex logical index
* @param[in] hide hidden or show
*/
void SetSectionHidden(int logicalIndex, bool hide);
private slots:
/**
* @brief
* @param[in] logicalIndex
* @param[in] oldSize
* @param[in] newSize
*/
void AdjustSectionSuitable(int logicalIndex, int oldSize, int newSize);
/**
* @brief
*/
void ReverseSectionVisible();
/**
* @brief
*/
void ShowSectionVisibleMenu();
/**
* @brief CheckBox选中信号
*/
void CheckBoxStateChanged();
private:
bool m_SectionSelectableVisible; ///< 控制是否可以在表格上可以有选择行的显示某些列的功能
QToolButton *m_pSectionSelectToolButton; ///< 选择显示列按钮
QStringList m_UnselectableSections; ///< 不可以被隐藏的表头名字列表
QMap<int, QCheckBox*> m_ColumnCheckBoxMap; ///< 列序号和对应列的CheckBox的映射
signals:
/**
* @brief
* @param[in] logicalIndex
* @param[in] globalPos
*/
void TitleRightClicked(int logicalIndex, const QPoint & globalPos);
/**
* @brief
* @param[in] logicalIndex
* @param[in] checkstate
*/
void CheckStateChanged(int logicalIndex, Qt::CheckState checkstate);
/**
* @brief
* @param[in] logicalIndex
* @param[in] visible shown or hidden
*/
void SectionVisibleChanged(int logicalIndex, bool visible);
};
}
}
#endif ///< PAI_FRAME_WIDGET_PAIHEADERVIEW_H