#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 public: explicit ZxPenEdit(QWidget *parent = 0); void setPen( const QPen& pen ); QPen getPen(); signals: void signalPenStyleChanged(int); void signalPenColorChanged(QColor); void signalPenWidthChanged(qreal); protected slots: void onStyleChanged(int); void onRadiusChanged(); void onColorChanged(const QColor&); 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 getConponentRect( QRect& rcLine, QRect& rcWidth, QRect& rcColor ); ZxLineStyleComboBox* getLineStyleComboBox(); QLineEdit* getLineWidthEdit(); ZxColorPicker* getColorPicker(); //线宽的单位 enum LineWidthUnit { Millimeter, //毫米 Millimeter_div_10 //0.1毫米 }; protected: LineWidthUnit m_lineWidthUnit; int m_widthWidth;//线宽编辑控件的宽度 int m_colorWidth;//颜色部分的宽度 QPen m_pen; ZxLineStyleComboBox* m_lineStyle; QLineEdit* m_lineWidth; ZxColorPicker* m_colorPicker; };