#pragma once #include #include #include "ZxDot.h" #include "ZxDotStyleComboBox.h" #include "ZxColorPicker.h" #include "ZxDrawHelper.h" #include "iProperty_global.h" class ZxDot; // ZxDotEdit Widget class I_PROPERTY_EXPORT ZxDotEdit : public QWidget { Q_OBJECT public: explicit ZxDotEdit(QWidget* parent = 0); // 载体 void setDot(const ZxDot& o); ZxDot getDot(); signals: // 四种信号 void sigDotStyleChanged(int); void sigDotColorChanged(QColor); void sigDotRadiusChanged(double); void sigDotFillingChanged(bool); protected slots: // Changed,Filling在内部处理 void onStyleChanged(int nStyle); void onRadiusChanged(); void onColorChanged(const QColor& clr); protected: virtual void paintEvent(QPaintEvent*); virtual void mousePressEvent(QMouseEvent*); virtual void mouseMoveEvent(QMouseEvent*); virtual void resizeEvent(QResizeEvent*); protected: // 控件的显示与隐藏 void showStyleWidget(const QRect& rcLine); void showRadiusWidget(const QRect& rcWidth); void hideStyleWidget(); void hideRadiusWidget(); // 四种的Layout void layoutRects(); // 子控件,Filling在内部处理 ZxDotStyleComboBox* getStyleCbx(); QLineEdit* getRadiusEdit(); ZxColorPicker* getColorPicker(); protected: ZxDot m_oDot; //数据载体 // 控件 ZxDotStyleComboBox* m_pCbxType; QLineEdit* m_pTbxRadius; ZxColorPicker* m_pClrPicker; // 位置,四个Rect: Style radius filling color QVector m_vecRects; };