logplus/qtpropertybrowser/qtComboBox.h

116 lines
2.9 KiB
C
Raw Permalink Normal View History

/**
* @file QtComboBox.h
* @brief ComboBox控件
* @date 2011-10-17
*/
#ifndef PAI_FRAME_WIDGET_QtComboBox_H
#define PAI_FRAME_WIDGET_QtComboBox_H
#include <QComboBox>
#include <QToolButton>
#include <QMargins>
#include "qtpropertybrowser.h"
/**
* @class QtComboBox
* @brief QtComboBox是P.A.I系统定制发布的组合框
*/
class QTPROPERTYBROWSER_EXPORT QtComboBox : public QComboBox
{
Q_OBJECT
public:
/**
* @brief
* @param[in] pParent
*/
QtComboBox(QWidget *pParent = NULL);
/**
* @brief
* @param[in] showAddButton
* @param[in] pParent
*/
QtComboBox(bool showAddButton, QWidget *pParent = NULL);
/**
* @brief
*/
virtual ~QtComboBox();
/**
* @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:
QToolButton *m_pEditButton; ///< 编辑按钮
bool m_RealTimeValidate; ///< 实时校验标志
bool m_AddButton; ///< 添加按钮
int m_MaxVisibleItems; ///< 最大可视条数
QMargins m_margin; ///< 间隔区域
signals:
/**
* @brief EditButton的点击事件
*/
void EditButtonClicked();
};
#endif ///< PAI_FRAME_WIDGET_QtComboBox_H