#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: virtual void onStyleClicked(int nStyle); virtual void onColorChanged(const QColor& clr); protected: virtual void paintEvent(QPaintEvent *); virtual void mousePressEvent(QMouseEvent *); virtual void resizeEvent(QResizeEvent *); protected: // 布局 void splitSubBounds(QRect& rcStyle, QRect& rcColor); // 获取子窗体(刷子+颜色) ZxBrushStyleComboBox* getBrushStyleComboBox(); ZxColorPicker* getColorPicker(); // 显示隐藏 void showBrushStyleWidget(const QRect& rcStyle); void hideBrushStyleWidget(); protected: // 颜色部分的宽度 int m_nClrWidth; QBrush m_brush; // 子窗体(刷子+颜色) ZxBrushStyleComboBox* m_pBrushStyle; ZxColorPicker* m_pClrPicker; };