#pragma once #include #include #include "iProperty_global.h" class ZxBrushStyleComboBox; class QPaintEvent; class QMouseEvent; class ZxColorPicker; /// 画刷编辑控件 class I_PROPERTY_EXPORT ZxBrushEdit : public QWidget { Q_OBJECT public: explicit ZxBrushEdit(QWidget *parent = 0); void setBrush( const QBrush& brush ); QBrush getBrush(); signals: void signalBrushStyleChanged(int); void signalBrushColorChanged(QColor); protected slots: void onStyleClicked(int); void onColorChanged(const QColor&); protected: virtual void paintEvent(QPaintEvent *); virtual void mousePressEvent(QMouseEvent *); virtual void resizeEvent(QResizeEvent *); protected: void showBrushStyleWidget(const QRect &rcStyle); void hideBrushStyleWidget(); void getConponentRect( QRect& rcStyle, QRect& rcColor ); ZxBrushStyleComboBox* getBrushStyleComboBox(); ZxColorPicker* getColorPicker(); protected: int m_colorWidth;//颜色部分的宽度 QBrush m_brush; ZxBrushStyleComboBox* m_brushStyle; ZxColorPicker* m_colorPicker; };