No need anymore to disable the drawing of the selection border.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-03-31 20:27:40 +03:00
parent 9f5fd98865
commit 9a6a5be59d
12 changed files with 2 additions and 91 deletions

View File

@ -46,19 +46,6 @@ VAbstractSpline::VAbstractSpline(VAbstractPattern *doc, VContainer *data, quint3
VAbstractSpline::~VAbstractSpline() VAbstractSpline::~VAbstractSpline()
{} {}
//---------------------------------------------------------------------------------------------------------------------
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);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VAbstractSpline::getTagName() const QString VAbstractSpline::getTagName() const
{ {

View File

@ -44,8 +44,6 @@ public:
virtual ~VAbstractSpline() Q_DECL_OVERRIDE; virtual ~VAbstractSpline() Q_DECL_OVERRIDE;
// cppcheck-suppress duplInheritedMember // cppcheck-suppress duplInheritedMember
static const QString TagName; static const QString TagName;
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
QWidget * widget = 0) Q_DECL_OVERRIDE;
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::AbstractSpline)}; enum { Type = UserType + static_cast<int>(Tool::AbstractSpline)};
virtual QString getTagName() const Q_DECL_OVERRIDE; virtual QString getTagName() const Q_DECL_OVERRIDE;

View File

@ -60,19 +60,6 @@ VToolDoublePoint::VToolDoublePoint(VAbstractPattern *doc, VContainer *data, quin
VToolDoublePoint::~VToolDoublePoint() VToolDoublePoint::~VToolDoublePoint()
{} {}
//---------------------------------------------------------------------------------------------------------------------
void VToolDoublePoint::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);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VToolDoublePoint::nameP1() const QString VToolDoublePoint::nameP1() const
{ {

View File

@ -48,9 +48,6 @@ public:
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::DoublePoint)}; enum { Type = UserType + static_cast<int>(Tool::DoublePoint)};
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
QWidget * widget = 0) Q_DECL_OVERRIDE;
QString nameP1() const; QString nameP1() const;
void setNameP1(const QString &name); void setNameP1(const QString &name);

View File

@ -77,19 +77,6 @@ VToolSinglePoint::VToolSinglePoint(VAbstractPattern *doc, VContainer *data, quin
VToolSinglePoint::~VToolSinglePoint() VToolSinglePoint::~VToolSinglePoint()
{} {}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::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);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VToolSinglePoint::name() const QString VToolSinglePoint::name() const
{ {

View File

@ -48,8 +48,6 @@ public:
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::SinglePoint)}; enum { Type = UserType + static_cast<int>(Tool::SinglePoint)};
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
QWidget * widget = 0) Q_DECL_OVERRIDE;
QString name() const; QString name() const;
void setName(const QString &name); void setName(const QString &name);

View File

@ -165,19 +165,6 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
return nullptr; 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);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VToolLine::getTagName() const QString VToolLine::getTagName() const
{ {

View File

@ -49,8 +49,7 @@ public:
VAbstractPattern *doc, VContainer *data, const Document &parse, VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation); const Source &typeCreation);
static const QString TagName; static const QString TagName;
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
QWidget * widget = 0) Q_DECL_OVERRIDE;
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Line)}; enum { Type = UserType + static_cast<int>(Tool::Line)};
virtual QString getTagName() const Q_DECL_OVERRIDE; virtual QString getTagName() const Q_DECL_OVERRIDE;

View File

@ -89,19 +89,6 @@ VControlPointSpline::~VControlPointSpline()
RestoreOverrideCursor(cursorArrowOpenHand); RestoreOverrideCursor(cursorArrowOpenHand);
} }
//---------------------------------------------------------------------------------------------------------------------
void VControlPointSpline::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 hoverEnterEvent handle hover enter events. * @brief hoverEnterEvent handle hover enter events.

View File

@ -47,8 +47,7 @@ public:
const QPointF &splinePoint, Unit patternUnit, bool freeAngle, bool freeLength, const QPointF &splinePoint, Unit patternUnit, bool freeAngle, bool freeLength,
QGraphicsItem * parent = nullptr); QGraphicsItem * parent = nullptr);
virtual ~VControlPointSpline() Q_DECL_OVERRIDE; virtual ~VControlPointSpline() Q_DECL_OVERRIDE;
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
QWidget * widget = 0) Q_DECL_OVERRIDE;
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ControlPointSpline)}; enum { Type = UserType + static_cast<int>(Vis::ControlPointSpline)};
signals: signals:

View File

@ -65,19 +65,6 @@ void VSimplePoint::ChangedActivDraw(const bool &flag)
SetPen(this, currentColor, WidthHairLine(patternUnit)); SetPen(this, currentColor, WidthHairLine(patternUnit));
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimplePoint::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);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSimplePoint::RefreshLine() void VSimplePoint::RefreshLine()
{ {

View File

@ -45,8 +45,6 @@ public:
virtual ~VSimplePoint() Q_DECL_OVERRIDE; virtual ~VSimplePoint() Q_DECL_OVERRIDE;
virtual void ChangedActivDraw(const bool &flag) Q_DECL_OVERRIDE; virtual void ChangedActivDraw(const bool &flag) Q_DECL_OVERRIDE;
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
QWidget * widget = 0) Q_DECL_OVERRIDE;
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Vis::SimplePoint)}; enum { Type = UserType + static_cast<int>(Vis::SimplePoint)};