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.
79 lines
1.5 KiB
C++
79 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <QWidget>
|
|
#include <QPen>
|
|
#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;
|
|
};
|
|
|
|
|
|
|
|
|