|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include "iGridRowItem.h"
|
|
|
|
|
|
|
|
|
|
|
|
class ZxComboBox;
|
|
|
|
|
|
class iUnitWxBinder;
|
|
|
|
|
|
|
|
|
|
|
|
// 对于有单位的生成,目前默认所有的均有单位,为了对齐
|
|
|
|
|
|
class X_GUI_GRIDPTY_EXPORT iGridRowItemUnt : public iGridRowItem
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
explicit iGridRowItemUnt(iGridRowItem* pParent = nullptr);
|
|
|
|
|
|
~iGridRowItemUnt();
|
|
|
|
|
|
|
|
|
|
|
|
virtual void setDlgBase(QWidget* p);
|
|
|
|
|
|
virtual void setParameter(iParameter* p);
|
|
|
|
|
|
|
|
|
|
|
|
// 控件
|
|
|
|
|
|
virtual void initEditor();
|
|
|
|
|
|
virtual void configEditor();
|
|
|
|
|
|
virtual void initOtherEditors();
|
|
|
|
|
|
|
|
|
|
|
|
virtual bool isInputOk();
|
|
|
|
|
|
virtual void setActive(bool b);
|
|
|
|
|
|
|
|
|
|
|
|
// 范围
|
|
|
|
|
|
virtual void setBounds(QRectF& rt);//全局
|
|
|
|
|
|
virtual QRectF getRightBounds_Main();//右
|
|
|
|
|
|
virtual QRectF getRightBounds_Unt(); // 单位以文本显示时的范围)
|
|
|
|
|
|
virtual QRectF getRightBounds_UntCbx();//单位以ComboBox显示时的范围
|
|
|
|
|
|
|
|
|
|
|
|
// 允许在外部调整参数,主要指的是产量单位,处理方/万方问题
|
|
|
|
|
|
// 该函数暂未启用(调试时用过)
|
|
|
|
|
|
virtual void setShowUnit(QString sUnit, QString sUnitRaw = "");
|
|
|
|
|
|
|
|
|
|
|
|
virtual QString getUnit(bool bUnitRaw = false);
|
|
|
|
|
|
|
|
|
|
|
|
virtual QVariant getInfoRight();
|
|
|
|
|
|
virtual QString getInfoUnit();
|
|
|
|
|
|
|
|
|
|
|
|
virtual bool setCurValue(QVariant o);
|
|
|
|
|
|
virtual QVariant getCurValue();
|
|
|
|
|
|
virtual QString getShowValue(); //非激活时显示在右侧的文本
|
|
|
|
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
|
|
|
|
|
|
|
|
void slotUnitChanged(QString s);
|
|
|
|
|
|
|
|
|
|
|
|
// QLineEdit 类型的数据change响应
|
|
|
|
|
|
virtual void slotItemValueChanged(QString s);
|
|
|
|
|
|
|
|
|
|
|
|
/// @brief 对于参数/单位绑定的情形,数据编辑,允许外部进行判断是否合理
|
|
|
|
|
|
/// @param sPara 具体哪个参数,英文标识
|
|
|
|
|
|
/// @param baseValue 基准数值,并非显示数值
|
|
|
|
|
|
/// @param bValid 是否有效的数值,返回值
|
|
|
|
|
|
virtual void slotValidateParaInput(const QString sPara, const double baseValue, bool& bValid);
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
// 绘图
|
|
|
|
|
|
virtual void paint(QPainter* pPainter);
|
|
|
|
|
|
|
|
|
|
|
|
// 显示单位文本信息
|
|
|
|
|
|
void _paintItemUnit(QPainter* pPainter, QString s);
|
|
|
|
|
|
|
|
|
|
|
|
// 原始的Painter drawText模式
|
|
|
|
|
|
// (该模式在Qt4下,对于10^4m^3形式,数字上标不正常,字母上标还基本OK)
|
|
|
|
|
|
void _paintItemUnit_ByNormal(QPainter* pPainter, QString s, QRectF rt);
|
|
|
|
|
|
|
|
|
|
|
|
// TextDocument模式,采用html模式
|
|
|
|
|
|
void _paintItemUnit_ByRich(QPainter* pPainter, QString s, QRectF rt);
|
|
|
|
|
|
|
|
|
|
|
|
// 格式化 10^4m^3 根据需要转为html
|
|
|
|
|
|
QString _formatToHtmlText(const QString& s, \
|
|
|
|
|
|
const bool bItalic, \
|
|
|
|
|
|
const QColor& clr, \
|
|
|
|
|
|
const int nFontSize);
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
ZxComboBox* m_pCbxUnits;
|
|
|
|
|
|
QStringList m_listUnitNames;
|
|
|
|
|
|
QStringList m_listUnitCodes; //对应的是ID
|
|
|
|
|
|
QString m_sCurUnit;
|
|
|
|
|
|
|
|
|
|
|
|
iUnitGroup* m_pUnitGroup; //只是缓存
|
|
|
|
|
|
|
|
|
|
|
|
bool m_bUnableSP; //临时变量
|
|
|
|
|
|
|
|
|
|
|
|
// 两变量暂未启用(调试时用过)
|
|
|
|
|
|
QString m_sUnit;
|
|
|
|
|
|
QString m_sUnitRaw; //20250704
|
|
|
|
|
|
|
|
|
|
|
|
iUnitWxBinder* m_pUnitBinder;
|
|
|
|
|
|
};
|