Detail bounding box is drawn when one of its items is in move, resize or rotate mode

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-08-02 22:51:40 +02:00
parent b48ac019d7
commit f2d5b00fd9
4 changed files with 29 additions and 0 deletions

View file

@ -164,6 +164,16 @@ void VTextGraphicsItem::Reset()
setZValue(TOP_Z); setZValue(TOP_Z);
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VTextGraphicsItem::IsIdle checks if the item is in normal mode.
* @return true, if item is in normal mode and false otherwise.
*/
bool VTextGraphicsItem::IsIdle() const
{
return m_eMode == mNormal;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief VTextGraphicsItem::AddLine adds a line of text to the label list. If necessary, it also resizes the * @brief VTextGraphicsItem::AddLine adds a line of text to the label list. If necessary, it also resizes the

View file

@ -59,6 +59,7 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void Reset(); void Reset();
bool IsIdle() const;
int GetFontSize() const; int GetFontSize() const;
QRectF boundingRect() const; QRectF boundingRect() const;

View file

@ -331,6 +331,22 @@ void VToolDetail::FullUpdateFromGuiOk(int result)
dialog = nullptr; dialog = nullptr;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolDetail::paint draws a bounding box around detail, if one of its text items is not idle.
*/
void VToolDetail::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
if (dataLabel->IsIdle() == false || patternInfo->IsIdle() == false)
{
painter->save();
painter->setPen(QPen(Qt::black, 3, Qt::DashLine));
painter->drawRect(boundingRect().adjusted(1, 1, -1, -1));
painter->restore();
}
VNoBrushScalePathItem::paint(painter, option, widget);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief AddToFile add tag with informations about tool into file. * @brief AddToFile add tag with informations about tool into file.

View file

@ -96,6 +96,8 @@ public slots:
virtual void ResetChildren(QGraphicsItem* pItem); virtual void ResetChildren(QGraphicsItem* pItem);
virtual void UpdateAll(); virtual void UpdateAll();
protected: protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget) Q_DECL_OVERRIDE;
virtual void AddToFile () Q_DECL_OVERRIDE; virtual void AddToFile () Q_DECL_OVERRIDE;
virtual void RefreshDataInFile() Q_DECL_OVERRIDE; virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE; virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;