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.
nmWATI/Include/iGui/iGuiBase/iDlgBaseEx.h

78 lines
1.6 KiB
C

#pragma once
#include "iDlgBase.h"
/// @brief 基础窗体类,实现 如下功能
/// (1) 在右下或者左上绘制按钮,实现一些简单的折叠功能
class X_GUI_BASE_EXPORT iDlgBaseEx : public iDlgBase
{
Q_OBJECT
public:
explicit iDlgBaseEx(QWidget *parent = 0);
~iDlgBaseEx();
// 是否启用
void setUseMode(bool b);
bool isUseMode();
// 设置Btn的位置针对全局
void setBtnPos(RectPos o);
// 按钮范围
QRect getBtnRect();
// 按钮图标
// 可以为全路径,或者图标名称(不带后缀)
// 如果sIcon2非空则轮换
void setBtnIcons(QString sIcon1, QString sIcon2 = "");
protected:
virtual void paintEvent(QPaintEvent *e);
virtual void paintBtn(QPainter *pPainter, bool bHovering);
virtual void resizeEvent(QResizeEvent *e);
virtual void mouseMoveEvent(QMouseEvent *mouseEvent);
virtual void mousePressEvent(QMouseEvent *mouseEvent);
virtual void leaveEvent(QEvent *e);
protected:
void calBtnRect();
// 虚拟按钮的响应
// 如果返回true则不再触发信号否则触发
virtual bool runByVirtualBtn();
signals:
void sigRunByBtn(bool bShowFirstIcon);
void sigShowParam(bool IsShow);
private slots:
// void slotWxImageInit();
// void slotIsAddBt(bool IsAdd);
protected:
// 是否启用
bool m_bUseMode;
// 鼠标Hover内部使用变量
bool m_bHover;
// 矩形框大小
QRect m_rtBtn;
// 图标
QString m_sIcon1;
QString m_sIcon2;
// 位置信息
RectPos m_oPos;
};