Remove border around qgraphicsitem when selected.
--HG-- branch : develop
This commit is contained in:
parent
36e90eb86b
commit
33ad980c91
|
@ -38,6 +38,19 @@ VAbstractSpline::VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QG
|
|||
ignoreFullUpdate = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
/* From question on StackOverflow
|
||||
* https://stackoverflow.com/questions/10985028/how-to-remove-border-around-qgraphicsitem-when-selected
|
||||
*
|
||||
* There's no interface to disable the drawing of the selection border for the build-in QGraphicsItems. The only way
|
||||
* I can think of is derive your own items from the build-in ones and override the paint() function:*/
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
QGraphicsPathItem::paint(painter, &myOption, widget);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
|
|
@ -39,6 +39,7 @@ class VAbstractSpline:public VDrawTool, public QGraphicsPathItem
|
|||
public:
|
||||
VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
|
||||
static const QString TagName;
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile ();
|
||||
void Disable(bool disable);
|
||||
|
|
|
@ -163,6 +163,19 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
/* From question on StackOverflow
|
||||
* https://stackoverflow.com/questions/10985028/how-to-remove-border-around-qgraphicsitem-when-selected
|
||||
*
|
||||
* There's no interface to disable the drawing of the selection border for the build-in QGraphicsItems. The only way
|
||||
* I can think of is derive your own items from the build-in ones and override the paint() function:*/
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
QGraphicsLineItem::paint(painter, &myOption, widget);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
static const QString TagName;
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
|
|
|
@ -58,6 +58,19 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
|
|||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
/* From question on StackOverflow
|
||||
* https://stackoverflow.com/questions/10985028/how-to-remove-border-around-qgraphicsitem-when-selected
|
||||
*
|
||||
* There's no interface to disable the drawing of the selection border for the build-in QGraphicsItems. The only way
|
||||
* I can think of is derive your own items from the build-in ones and override the paint() function:*/
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
QGraphicsEllipseItem::paint(painter, &myOption, widget);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief NameChangePosition handle change posion point label.
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
|
||||
virtual ~VToolPoint(){}
|
||||
static const QString TagName;
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
|
||||
public slots:
|
||||
void NameChangePosition(const QPointF &pos);
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
|
|
Loading…
Reference in New Issue
Block a user