#pragma once #include #include #include "iProperty_global.h" class ZxLineStyleComboBox; class QLineEdit; class QMouseEvent; class QPaintEvent; class QResizeEvent; class ZxColorPicker; // ZxPenEdit class I_PROPERTY_EXPORT ZxPenEdit : public QWidget { Q_OBJECT // 线宽的单位 enum LineWidthUnit { LWU_mm = 0, //毫米 LWU_mm_div_10 //0.1毫米 }; public: ZxPenEdit(QWidget* parent = 0); void setPen(const QPen& pen); QPen getPen(); signals: void signalPenStyleChanged(int); void signalPenColorChanged(QColor); void signalPenWidthChanged(qreal); protected slots: virtual void onStyleChanged(int nStyle); virtual void onRadiusChanged(); virtual void onColorChanged(const QColor& clr); protected: virtual void paintEvent(QPaintEvent *); virtual void mousePressEvent(QMouseEvent *); virtual void resizeEvent(QResizeEvent *); protected: void showLineStyleWidget(const QRect& rcLine); void showLineWidthWidget(const QRect& rcWidth); void hideLineStyleWidget(); void hideLineWidthWidget(); void splitSubBounds(QRect& rcLine, QRect& rcWidth, QRect& rcColor); ZxLineStyleComboBox* getLineStyleCbx(); QLineEdit* getLineWidthTbx(); ZxColorPicker* getColorPicker(); protected: LineWidthUnit m_oLWU; int m_nPenWidth;//线宽编辑控件的宽度 int m_nClrWidth;//颜色部分的宽度 QPen m_pen; ZxLineStyleComboBox* m_pCbxLineStyle; QLineEdit* m_pTbxLineWidth; ZxColorPicker* m_pClrPicker; };