Fixed a bug with QGraphicsItem class. QGraphicsItem itself produce case where

clicking on empty space produce call to QGraphicsItem.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-05-20 14:41:57 +03:00
parent d30ea3bca8
commit 05fdbcf8f5
2 changed files with 5 additions and 18 deletions

View File

@ -52,7 +52,7 @@ VToolRotation::VToolRotation(VAbstractPattern *doc, VContainer *data, quint32 id
const QVector<DestinationItem> &destination, const Source &typeCreation, const QVector<DestinationItem> &destination, const Source &typeCreation,
QGraphicsItem *parent) QGraphicsItem *parent)
: VDrawTool(doc, data, id), : VDrawTool(doc, data, id),
QGraphicsItem(parent), QGraphicsLineItem(parent),
origPointId(origPointId), origPointId(origPointId),
formulaAngle(angle), formulaAngle(angle),
suffix(suffix), suffix(suffix),
@ -652,20 +652,6 @@ void VToolRotation::SetVisualization()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QRectF VToolRotation::boundingRect() const
{
QRectF recTool;
const QList<QGraphicsItem *> items = childItems();
foreach (QGraphicsItem *item, items)
{
recTool = recTool.united(item->boundingRect());
recTool = recTool.united(item->childrenBoundingRect());
}
return recTool;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolRotation::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void VToolRotation::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {

View File

@ -42,7 +42,10 @@ class VAbstractSimple;
class VSimpleCurve; class VSimpleCurve;
class VFormula; class VFormula;
class VToolRotation : public VDrawTool, public QGraphicsItem // FIXME. I don't know how to use QGraphicsItem properly, so just took first available finished class.
// QGraphicsItem itself produce case where clicking on empty space produce call to QGraphicsItem.
// And i don't know how to fix it.
class VToolRotation : public VDrawTool, public QGraphicsLineItem
{ {
Q_OBJECT Q_OBJECT
// Fix warning "Class implements the interface QGraphicsItem but does not list it // Fix warning "Class implements the interface QGraphicsItem but does not list it
@ -77,8 +80,6 @@ public:
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE; virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
public slots: public slots: