You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iBase/iProperty/PtyItems/ZxDotEdit.h

82 lines
1.6 KiB
C

#pragma once
#include <QWidget>
#include <QLineEdit>
#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<QRect> m_vecRects;
};