|
|
#pragma once
|
|
|
|
|
|
#include <QTextEdit>
|
|
|
#include "ZxObjBase.h"
|
|
|
|
|
|
class I_PLOTCURVE_T_EXPORT ZxObjRect
|
|
|
: public ZxObjBase
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
|
|
public:
|
|
|
|
|
|
ZxObjRect();
|
|
|
ZxObjRect(const QString& sName,
|
|
|
ZxSubAxisX* pAxisX,
|
|
|
ZxSubAxisY* pAxisY);
|
|
|
~ZxObjRect();
|
|
|
|
|
|
virtual void init(const QString& sName,
|
|
|
ZxSubAxisX* pAxisX,
|
|
|
ZxSubAxisY* pAxisY);
|
|
|
|
|
|
// 击中
|
|
|
virtual bool hitTest(const QPointF& pt);
|
|
|
|
|
|
// 具体击中实现的函数,单纯击中,不做选项的改变
|
|
|
// nOption用int是因为Rect类的击中选项不一致
|
|
|
// nOption为负值,表示未击中,此时返回false
|
|
|
virtual bool _runHitTest(const QPointF& pt, int& nOption, int& nSubIndex);
|
|
|
|
|
|
// 为了方便而再次封装,仅仅判断位置
|
|
|
virtual RectPos _getPtPosOfRect(const QPointF& pt);
|
|
|
|
|
|
// 击中后,ButtonUp后的处理
|
|
|
// pt1:鼠标Down点,pt2:鼠标Up点
|
|
|
virtual bool runMove(const QPointF& pt1, const QPointF& pt2);
|
|
|
|
|
|
// 封装
|
|
|
virtual void initTools();
|
|
|
|
|
|
protected:
|
|
|
|
|
|
// 设置图元对象的属性标志
|
|
|
virtual void initFlags();
|
|
|
|
|
|
protected:
|
|
|
|
|
|
public:
|
|
|
|
|
|
virtual void paintBack(QPainter* painter,
|
|
|
const ZxPaintParam& param);
|
|
|
virtual void paintFrame(QPainter* painter);
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
|
|
virtual void onLoadTempl(ZxSerializer* ser);
|
|
|
virtual void onSaveTempl(ZxSerializer* ser);
|
|
|
|
|
|
virtual void fillPtyPano(IxPtyPano* sheet);
|
|
|
|
|
|
public:
|
|
|
|
|
|
// 边界
|
|
|
virtual float getL() const;
|
|
|
virtual void setL(float f);
|
|
|
virtual float getR() const;
|
|
|
virtual void setR(float f);
|
|
|
virtual float getT() const;
|
|
|
virtual void setT(float f);
|
|
|
virtual float getB() const;
|
|
|
virtual void setB(float f);
|
|
|
virtual void setValueByPos(const QPointF& ptTL, const QPointF& ptRB);
|
|
|
virtual void setValueByPos(const float& l, const float& r,
|
|
|
const float& t, const float& b);
|
|
|
|
|
|
// 是否显示边框
|
|
|
bool isFrameVisible(void) const;
|
|
|
void setFrameVisible(bool bIsShow);
|
|
|
|
|
|
// 背景色
|
|
|
QColor getBackgroundColor();
|
|
|
void setBackgroundColor(QColor color);
|
|
|
|
|
|
// 背景透明度
|
|
|
int getBackgroundAlpha();
|
|
|
void setBackgroundAlpha(int nAlpha);
|
|
|
|
|
|
protected:
|
|
|
|
|
|
bool m_bFrameVisible; //是否显示边框
|
|
|
QColor m_clrBackgrd; //背景色
|
|
|
|
|
|
public:
|
|
|
|
|
|
RectPos m_oHitPos;
|
|
|
|
|
|
// 临时变量
|
|
|
bool m_bAsBand;
|
|
|
bool m_bBanded;
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|