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/iBase/iPlugin/ZxUiBase.h

122 lines
3.3 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <QMap>
#include <QDialog>
#include "IxSerDes.h"
#include "iPlugin_global.h"
/// @brief 基础窗体类,实现 如下功能
/// (1) 序列化接口
/// (2) 存储Map
/// (3) 背景图片及样式设置
/// @note 关于序列化对话框或Widget的说明
/// (a)派生自ZxUiBase类
/// (b)通过bindSubCtrl绑定子控件 ==或者==
/// (c)通过重载onSerialize/onDeserialize两函数
class ZxSerializer;
class I_PLUGIN_EXPORT ZxUiBase : public QDialog,
virtual public IxSerDes
{
Q_OBJECT
public:
explicit ZxUiBase(QWidget *parent = 0);
~ZxUiBase();
public:
// 初始化
virtual void initUI();
virtual void initSheets(); //Sheet
// 根据分辨率对窗体大小进行适当调整只有在InitUI之后调用才会有效
virtual void resizeUI();
/// @brief 绑定子控件
/// @param p:子控件
/// @note Key系统自动管理确保不重复
virtual void bindSubCtrl(QWidget* p);
/// @brief 绑定子控件
/// @param p:子控件
/// @param sKey:Key为确保Key不重复Key可能被改变
/// @note
virtual void bindSubCtrl(QWidget* p, QString& sKey);
/// @brief 获取指定子控件
/// @param sKey:Key请调用者自己确定本Key不重复
/// @note 该函数慎用
virtual QWidget* getSubCtrl(QString sKey);
// 返回
virtual QMap<QString, QWidget *> *getMapCtrls();
virtual QMap<QString, QVariant> *getMapOthers();
// 序列化
virtual void onSerialize(ZxSerializer* ser);
virtual void onDeserialize(ZxSerializer* ser);
virtual void copyFrom(ZxUiBase* p);
virtual void copyOneSubCtrol(QWidget*& pFrom, QWidget*& pTo);
// 把Layout载体转换为ScrollArea
virtual QLayout* buildAsScrollLayout(QLayout* pLayout, QString sTag = QString());
// 清空Layout内容
bool clearLayoutOf(QWidget* pWidget);
bool clearLayout(QLayout* pLayout);
bool setLayoutVisible(QLayout* pLayout, bool bVisible);
public:
// 特殊的Esc设置
void setIgnoreEsc(bool b);
bool getIgnoreEsc();
signals:
// 在关闭的消息函数中触发
void sigConfirmClosing(bool& bClosable);
protected:
// 内部读写函数
virtual bool _writeCtrl(ZxSerializer* ser, QWidget* p, QString& sTag);
virtual bool _readCtrl(ZxSerializer* ser, QWidget*& p, QString& sTag);
protected slots:
virtual void slotIsUnableSP(bool& b);
protected:
// paint
virtual void paintEvent(QPaintEvent *);
// 窗体关闭的情形
virtual void closeEvent(QCloseEvent *);
// [20211213湛江专家测试反馈],压力流量视图按esc键会退出
// 原因:父类 ZxUiBase 派生自QDiaglog的缘故
// 原先只在iGuiPlotPF进行处理20240723移至本类
virtual void keyPressEvent(QKeyEvent* e);
protected:
// 这是对子控件的统一管理,为了序列化
QMap<QString, QWidget*> m_mapCtrls;
// 对于部分特定参数的保存
QMap<QString, QVariant> m_mapOthers;
// 在序列化过程中,不能触发信号
bool m_bUnableSP;
// [20211213湛江专家测试反馈],压力流量视图按esc键会退出
// 原因:父类 ZxUiBase 派生自QDiaglog的缘故
// 原先只在iGuiPlotPF进行处理20240723移至本类
bool m_bIgnoreEsc;
// 是否启用新的样式表ZXF202407
bool m_bNovelQss;
};