parent
e92afd0f89
commit
e8d1c28a15
|
@ -34,7 +34,9 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics
|
|||
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0)
|
||||
{
|
||||
namePoint = new VGraphicsSimpleTextItem(this);
|
||||
namePoint->setBrush(Qt::black);
|
||||
lineName = new QGraphicsLineItem(this);
|
||||
lineName->setPen(QPen(Qt::black));
|
||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
||||
&VToolPoint::NameChangePosition);
|
||||
this->setBrush(QBrush(Qt::NoBrush));
|
||||
|
@ -73,7 +75,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
|
|||
if (nameActivDraw == newName)
|
||||
{
|
||||
selectable = true;
|
||||
currentColor = Qt::black;
|
||||
currentColor = baseColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -150,7 +152,14 @@ void VToolPoint::RefreshLine()
|
|||
LineIntersectCircle(QPointF(), radius/factor, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
|
||||
QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
|
||||
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
||||
if(currentColor == Qt::gray)
|
||||
{
|
||||
lineName->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
}
|
||||
else
|
||||
{
|
||||
lineName->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
}
|
||||
if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4))
|
||||
{
|
||||
lineName->setVisible(false);
|
||||
|
|
|
@ -34,10 +34,13 @@ VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64
|
|||
QGraphicsItem * parent )
|
||||
:VToolPoint(doc, data, id, parent), dialogSinglePoint(QSharedPointer<DialogSinglePoint>())
|
||||
{
|
||||
baseColor = Qt::red;
|
||||
currentColor = baseColor;
|
||||
ignoreFullUpdate = true;
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsFocusable, false);
|
||||
setColorLabel(Qt::black);
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
AddToFile();
|
||||
|
@ -124,6 +127,12 @@ void VToolSinglePoint::decrementReferens()
|
|||
}
|
||||
}
|
||||
|
||||
void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
|
||||
{
|
||||
namePoint->setBrush(color);
|
||||
lineName->setPen(QPen(color, widthHairLine/factor));
|
||||
}
|
||||
|
||||
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
|
||||
{
|
||||
ContextMenu(dialogSinglePoint, this, event, false);
|
||||
|
@ -160,11 +169,13 @@ void VToolSinglePoint::ChangedActivDraw(const QString &newName)
|
|||
{
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
setColorLabel(Qt::black);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
setColorLabel(Qt::gray);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ private:
|
|||
* @brief dialogSinglePoint
|
||||
*/
|
||||
QSharedPointer<DialogSinglePoint> dialogSinglePoint;
|
||||
void setColorLabel(const Qt::GlobalColor & color);
|
||||
};
|
||||
|
||||
#endif // VTOOLSINGLEPOINT_H
|
||||
|
|
|
@ -278,7 +278,7 @@ protected:
|
|||
/**
|
||||
* @brief baseColor
|
||||
*/
|
||||
const Qt::GlobalColor baseColor;
|
||||
Qt::GlobalColor baseColor;
|
||||
/**
|
||||
* @brief currentColor
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user