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

131 lines
3.1 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 PaiComboBox.h
* @brief ComboBox控件
* @date 2011-10-17
*/
#ifndef PAI_FRAME_WIDGET_PAICOMBOBOX_H
#define PAI_FRAME_WIDGET_PAICOMBOBOX_H
#include <QComboBox>
#include <QToolButton>
#include <QMargins>
#include "Turtle.h"
namespace pai
{
namespace gui
{
class PaiLineEdit;
}
}
namespace pai
{
namespace gui
{
/**
* @class PaiComboBox
* @brief PaiComboBox是P.A.I系统定制发布的组合框
*/
class PAI_WIDGET_EXPORT PaiComboBox : public QComboBox
{
Q_OBJECT
public:
/**
* @brief 构造函数
* @param[in] pParent 父窗口句柄
*/
PaiComboBox(QWidget *pParent = NULL);
/**
* @brief 构造函数
* @param[in] showAddButton 是否显示右侧按钮
* @param[in] pParent 父窗口句柄
*/
PaiComboBox(bool showAddButton, QWidget *pParent = NULL);
/**
* @brief 析构函数
*/
virtual ~PaiComboBox();
/**
* @brief 设置是否使用实时过滤默认为false不使用。
* @param[in] flag true 使用实时过滤,反之关闭实时过滤
*/
void SetRealTimeValidate(bool flag);
/**
* @brief 设置是否添加Editbutton。
* @param[in] show true 添加Editbutton反之则不添加
*/
void SetShowAddButton(bool show);
/**
* @brief 重写函数,实现对显示数量的设定
*/
virtual void showPopup ();
/**
* @brief 获取选择列表一次显示的项目最大条数
* @return 最大条数
*/
int GetMaxVisibleItems() const;
/**
* @brief 设置选择列表一次显示的项目最大条数
* @param[in] count 最大显示条数
*/
void SetMaxVisibleItems(const int count);
/**
* @brief 重写系统函数使得在对ComboBox设置styleSheet的时候
* 它的下拉列表能够作出一些对应的调整,以使外观更加合适。
* @param[in] styleSheet sytleSheet字符串
*/
void setStyleSheet(const QString & styleSheet);
protected:
/**
* @brief 重写keyPressEvent用来处理输入限制的问题
* @param[in] pEvent 键盘按压事件
*/
virtual void keyPressEvent(QKeyEvent *pEvent);
/**
* @brief 重写resizeEvent用来处理变换大小的问题
* @param[in] pEvent 重置大小事件
*/
virtual void resizeEvent (QResizeEvent *pEvent);
/**
* @brief 重绘
* @param[in] pEvent 重画事件
*/
virtual void paintEvent(QPaintEvent *pEvent);
private:
/**
* @brief 初始化组件
*/
void InitComboBox();
private:
PaiLineEdit *m_pLineEdit; ///< 名称编辑框
QToolButton *m_pEditButton; ///< 编辑按钮
bool m_RealTimeValidate; ///< 实时校验标志
bool m_AddButton; ///< 添加按钮
int m_MaxVisibleItems; ///< 最大可视条数
QMargins m_margin; ///< 间隔区域
signals:
/**
* @brief EditButton的点击事件
*/
void EditButtonClicked();
};
}
}
#endif ///< PAI_FRAME_WIDGET_PAICOMBOBOX_H