Improve API for class VNoBrushScalePathItem. Added method SetWidth().
--HG-- branch : develop
This commit is contained in:
parent
c4d07125dc
commit
263b99ff19
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "vnobrushscalepathitem.h"
|
||||
#include "global.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
|
||||
#include <QBrush>
|
||||
#include <QMatrix>
|
||||
|
@ -35,10 +36,17 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VNoBrushScalePathItem::VNoBrushScalePathItem(QGraphicsItem *parent) :
|
||||
QGraphicsPathItem(parent)
|
||||
QGraphicsPathItem(parent),
|
||||
m_defaultWidth(qApp->Settings()->WidthHairLine())
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VNoBrushScalePathItem::SetWidth(qreal width)
|
||||
{
|
||||
m_defaultWidth = width;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VNoBrushScalePathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
|
@ -57,5 +65,10 @@ void VNoBrushScalePathItem::paint(QPainter *painter, const QStyleOptionGraphicsI
|
|||
QBrush brush = this->brush();
|
||||
brush.setMatrix(painter->combinedMatrix().inverted());
|
||||
this->setBrush(brush);
|
||||
|
||||
QPen toolPen = pen();
|
||||
toolPen.setWidthF(ScaleWidth(m_defaultWidth, SceneScale(scene())));
|
||||
setPen(toolPen);
|
||||
|
||||
PaintWithFixItemHighlightSelected<QGraphicsPathItem>(this, painter, option, widget);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ class VNoBrushScalePathItem : public QGraphicsPathItem
|
|||
public:
|
||||
explicit VNoBrushScalePathItem(QGraphicsItem *parent = nullptr);
|
||||
|
||||
void SetWidth(qreal width);
|
||||
|
||||
protected:
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
|
||||
QWidget * widget = nullptr) override;
|
||||
|
@ -49,6 +51,7 @@ protected:
|
|||
|
||||
private:
|
||||
Q_DISABLE_COPY(VNoBrushScalePathItem)
|
||||
qreal m_defaultWidth;
|
||||
};
|
||||
|
||||
#endif // VNOBRUSHSCALEPATHITEM_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user