2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file vtoolpoint.cpp
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2013-11-15 13:41:26 +01:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
#include "vtoolpoint.h"
|
2015-04-01 14:51:54 +02:00
|
|
|
#include "../../utils/logging.h"
|
2015-05-07 14:31:53 +02:00
|
|
|
#include "../../libs/vgeometry/vpointf.h"
|
2014-07-14 20:16:00 +02:00
|
|
|
#include "../../visualization/vgraphicssimpletextitem.h"
|
2014-12-25 12:33:27 +01:00
|
|
|
#include "../../undocommands/movelabel.h"
|
2013-09-10 14:29:06 +02:00
|
|
|
|
2015-04-01 14:51:54 +02:00
|
|
|
#include <QKeyEvent>
|
|
|
|
|
2015-03-02 20:20:09 +01:00
|
|
|
Q_LOGGING_CATEGORY(vToolPoint, "v.toolPoint")
|
|
|
|
|
2013-10-29 14:45:07 +01:00
|
|
|
const QString VToolPoint::TagName = QStringLiteral("point");
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief VToolPoint constructor.
|
|
|
|
* @param doc dom document container.
|
|
|
|
* @param data container with variables.
|
|
|
|
* @param id object id in container.
|
|
|
|
* @param parent parent object.
|
|
|
|
*/
|
2014-07-25 13:22:25 +02:00
|
|
|
VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
2014-08-17 17:20:55 +02:00
|
|
|
:VDrawTool(doc, data, id), QGraphicsEllipseItem(parent), radius(DefPointRadius), namePoint(nullptr),
|
|
|
|
lineName(nullptr)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-07-23 12:04:23 +02:00
|
|
|
radius = qApp->toPixel(DefPointRadius/*mm*/, Unit::Mm);
|
2013-09-10 14:29:06 +02:00
|
|
|
namePoint = new VGraphicsSimpleTextItem(this);
|
2015-04-22 15:30:47 +02:00
|
|
|
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::contextMenuEvent);
|
2014-10-24 20:17:23 +02:00
|
|
|
connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolPoint::DeleteFromLabel);
|
2015-03-19 14:02:39 +01:00
|
|
|
connect(namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VToolPoint::PointChoosed);
|
2013-09-10 14:29:06 +02:00
|
|
|
lineName = new QGraphicsLineItem(this);
|
2014-01-09 13:51:09 +01:00
|
|
|
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
|
2013-09-10 14:29:06 +02:00
|
|
|
this->setBrush(QBrush(Qt::NoBrush));
|
|
|
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
2014-01-03 16:13:43 +01:00
|
|
|
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
2013-09-10 14:29:06 +02:00
|
|
|
this->setAcceptHoverEvents(true);
|
2014-08-21 14:44:40 +02:00
|
|
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
|
|
|
|
2014-10-04 21:12:46 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VToolPoint::~VToolPoint()
|
|
|
|
{}
|
|
|
|
|
2014-07-24 12:20:26 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2014-08-28 13:05:58 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VToolPoint::name() const
|
|
|
|
{
|
2015-03-02 20:20:09 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
return VAbstractTool::data.GeometricObject<VPointF>(id)->name();
|
|
|
|
}
|
|
|
|
catch (const VExceptionBadId &e)
|
|
|
|
{
|
2015-04-01 19:08:35 +02:00
|
|
|
qCDebug(vToolPoint, "Error! Couldn't get point name. %s %s", e.ErrorMessage().toUtf8().constData(),
|
|
|
|
e.DetailedInformation().toUtf8().constData());
|
2015-03-02 20:20:09 +01:00
|
|
|
return QString("");// Return empty string for property browser
|
|
|
|
}
|
2014-08-28 13:05:58 +02:00
|
|
|
}
|
|
|
|
|
2014-08-30 21:58:31 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VToolPoint::setName(const QString &name)
|
|
|
|
{
|
2015-03-02 20:20:09 +01:00
|
|
|
// Don't know if need check name here.
|
2014-08-30 21:58:31 +02:00
|
|
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
|
|
|
obj->setName(name);
|
|
|
|
SaveOption(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VToolPoint::getTagName() const
|
|
|
|
{
|
|
|
|
return VToolPoint::TagName;
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief NameChangePosition handle change posion point label.
|
|
|
|
* @param pos new position.
|
|
|
|
*/
|
2013-11-07 15:40:39 +01:00
|
|
|
void VToolPoint::NameChangePosition(const QPointF &pos)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-08-21 14:44:40 +02:00
|
|
|
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
2013-09-10 14:29:06 +02:00
|
|
|
QPointF p = pos - this->pos();
|
2013-12-29 17:48:57 +01:00
|
|
|
point->setMx(p.x());
|
|
|
|
point->setMy(p.y());
|
2013-09-10 14:29:06 +02:00
|
|
|
RefreshLine();
|
2013-12-29 17:48:57 +01:00
|
|
|
UpdateNamePosition(point->mx(), point->my());
|
|
|
|
VAbstractTool::data.UpdateGObject(id, point);
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief UpdateNamePosition save new position label to the pattern file.
|
|
|
|
* @param mx label bias x axis.
|
|
|
|
* @param my label bias y axis.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
|
|
|
|
{
|
2014-12-25 12:33:27 +01:00
|
|
|
MoveLabel *moveLabel = new MoveLabel(doc, mx, my, id, this->scene());
|
|
|
|
connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VPattern::LiteParseTree);
|
|
|
|
qApp->getUndoStack()->push(moveLabel);
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief ShowTool highlight tool.
|
|
|
|
* @param id object id in container.
|
|
|
|
* @param enable enable or disable highlight.
|
|
|
|
*/
|
2015-02-07 16:18:18 +01:00
|
|
|
void VToolPoint::ShowTool(quint32 id, bool enable)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2015-02-07 16:18:18 +01:00
|
|
|
ShowItem(this, id, enable);
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief SetFactor set current scale factor of scene.
|
|
|
|
* @param factor scene scale factor.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void VToolPoint::SetFactor(qreal factor)
|
|
|
|
{
|
2013-10-16 11:17:34 +02:00
|
|
|
VDrawTool::SetFactor(factor);
|
2014-08-21 14:44:40 +02:00
|
|
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
2013-10-16 11:17:34 +02:00
|
|
|
}
|
|
|
|
|
2014-06-24 10:23:39 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-05-25 08:24:16 +02:00
|
|
|
void VToolPoint::Disable(bool disable, const QString &namePP)
|
2014-06-24 10:23:39 +02:00
|
|
|
{
|
2015-05-25 08:24:16 +02:00
|
|
|
enabled = !CorrectDisable(disable, namePP);
|
2015-02-06 13:31:40 +01:00
|
|
|
this->setEnabled(enabled);
|
|
|
|
namePoint->setEnabled(enabled);
|
2014-06-24 10:23:39 +02:00
|
|
|
}
|
|
|
|
|
2014-10-24 20:17:23 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VToolPoint::DeleteFromLabel()
|
|
|
|
{
|
|
|
|
DeleteTool(); //Leave this method immediately after call!!!
|
|
|
|
}
|
|
|
|
|
2015-03-19 12:13:13 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VToolPoint::EnableToolMove(bool move)
|
|
|
|
{
|
|
|
|
namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
|
|
|
|
}
|
|
|
|
|
2015-03-19 14:02:39 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VToolPoint::PointChoosed()
|
|
|
|
{
|
|
|
|
emit ChoosedTool(id, SceneObject::Point);
|
|
|
|
}
|
|
|
|
|
2015-05-28 14:36:26 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief FullUpdateFromFile update tool data form file.
|
|
|
|
*/
|
|
|
|
void VToolPoint::FullUpdateFromFile()
|
|
|
|
{
|
|
|
|
ReadAttributes();
|
|
|
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
|
|
|
SetVisualization();
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief mouseReleaseEvent handle mouse release events.
|
|
|
|
* @param event mouse release event.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
|
|
{
|
|
|
|
if (event->button() == Qt::LeftButton)
|
|
|
|
{
|
2015-03-19 14:02:39 +01:00
|
|
|
PointChoosed();
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
2014-08-19 13:16:00 +02:00
|
|
|
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
2014-08-19 13:16:00 +02:00
|
|
|
* @brief hoverEnterEvent handle hover enter events.
|
|
|
|
* @param event hover enter event.
|
2014-06-13 19:02:41 +02:00
|
|
|
*/
|
2014-08-19 13:16:00 +02:00
|
|
|
void VToolPoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-09-10 14:29:06 +02:00
|
|
|
Q_UNUSED(event);
|
2015-02-06 12:41:30 +01:00
|
|
|
this->setPen(QPen(CorrectColor(baseColor), qApp->toPixel(qApp->widthMainLine())/factor));
|
2014-08-19 13:16:00 +02:00
|
|
|
QGraphicsEllipseItem::hoverEnterEvent(event);
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief hoverLeaveEvent handle hover leave events.
|
|
|
|
* @param event hover leave event.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
|
|
{
|
2013-09-10 14:29:06 +02:00
|
|
|
Q_UNUSED(event);
|
2015-02-06 12:41:30 +01:00
|
|
|
this->setPen(QPen(CorrectColor(baseColor), qApp->toPixel(qApp->widthHairLine())/factor));
|
2015-02-09 10:54:19 +01:00
|
|
|
QGraphicsEllipseItem::hoverLeaveEvent(event);
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief RefreshPointGeometry refresh point on scene.
|
|
|
|
* @param point point.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void VToolPoint::RefreshPointGeometry(const VPointF &point)
|
|
|
|
{
|
2014-06-16 09:52:55 +02:00
|
|
|
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
2015-02-06 12:41:30 +01:00
|
|
|
this->setPen(QPen(CorrectColor(baseColor), qApp->toPixel(qApp->widthHairLine())/factor));
|
2014-12-25 17:21:56 +01:00
|
|
|
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
2013-09-10 14:29:06 +02:00
|
|
|
rec.translate(-rec.center().x(), -rec.center().y());
|
|
|
|
this->setRect(rec);
|
|
|
|
this->setPos(point.toQPointF());
|
2014-06-09 15:13:15 +02:00
|
|
|
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
2014-08-09 10:43:01 +02:00
|
|
|
namePoint->blockSignals(true);
|
2013-10-16 11:17:34 +02:00
|
|
|
QFont font = namePoint->font();
|
|
|
|
font.setPointSize(static_cast<qint32>(namePoint->FontSize()/factor));
|
|
|
|
namePoint->setFont(font);
|
2013-09-10 14:29:06 +02:00
|
|
|
namePoint->setText(point.name());
|
|
|
|
namePoint->setPos(QPointF(point.mx(), point.my()));
|
2014-08-09 10:43:01 +02:00
|
|
|
namePoint->blockSignals(false);
|
2013-09-10 14:29:06 +02:00
|
|
|
RefreshLine();
|
2014-06-16 09:52:55 +02:00
|
|
|
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief RefreshLine refresh line to label on scene.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void VToolPoint::RefreshLine()
|
|
|
|
{
|
2014-08-17 21:34:01 +02:00
|
|
|
QRectF nRec = namePoint->sceneBoundingRect();
|
|
|
|
nRec.translate(- scenePos());
|
|
|
|
if (this->rect().intersects(nRec) == false)
|
2014-01-07 13:54:50 +01:00
|
|
|
{
|
2014-08-17 21:34:01 +02:00
|
|
|
QRectF nameRec = namePoint->sceneBoundingRect();
|
|
|
|
QPointF p1, p2;
|
2014-12-25 18:19:31 +01:00
|
|
|
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center() - scenePos()), p1, p2);
|
2014-10-23 10:38:57 +02:00
|
|
|
QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
|
2014-08-17 21:34:01 +02:00
|
|
|
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
2015-02-06 10:53:36 +01:00
|
|
|
lineName->setPen(QPen(CorrectColor(Qt::black), qApp->toPixel(qApp->widthHairLine())/factor));
|
2014-08-17 21:34:01 +02:00
|
|
|
|
|
|
|
if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4, Unit::Mm))
|
|
|
|
{
|
|
|
|
lineName->setVisible(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lineName->setVisible(true);
|
|
|
|
}
|
2014-01-07 13:54:50 +01:00
|
|
|
}
|
|
|
|
else
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-09-10 14:29:06 +02:00
|
|
|
lineName->setVisible(false);
|
2013-11-04 21:35:15 +01:00
|
|
|
}
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
2014-01-03 16:13:43 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief itemChange hadle item change.
|
|
|
|
* @param change change.
|
|
|
|
* @param value value.
|
|
|
|
* @return value.
|
|
|
|
*/
|
2014-01-03 16:13:43 +01:00
|
|
|
QVariant VToolPoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
|
|
|
{
|
|
|
|
if (change == QGraphicsItem::ItemSelectedChange)
|
|
|
|
{
|
|
|
|
if (value == true)
|
|
|
|
{
|
|
|
|
// do stuff if selected
|
|
|
|
this->setFocus();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// do stuff if not selected
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return QGraphicsItem::itemChange(change, value);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief keyReleaseEvent handle key release events.
|
|
|
|
* @param event key release event.
|
|
|
|
*/
|
2014-01-03 16:13:43 +01:00
|
|
|
void VToolPoint::keyReleaseEvent(QKeyEvent *event)
|
|
|
|
{
|
|
|
|
switch (event->key())
|
|
|
|
{
|
|
|
|
case Qt::Key_Delete:
|
2014-10-04 08:37:19 +02:00
|
|
|
DeleteTool();
|
2014-10-04 21:12:46 +02:00
|
|
|
return; //Leave this method immediately after call!!!
|
2014-01-03 16:13:43 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-08-19 13:16:00 +02:00
|
|
|
QGraphicsEllipseItem::keyReleaseEvent ( event );
|
2014-01-03 16:13:43 +01:00
|
|
|
}
|
2015-02-06 10:53:36 +01:00
|
|
|
|
2015-04-22 15:30:47 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VToolPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
|
|
{
|
|
|
|
Q_UNUSED(event)
|
|
|
|
}
|
|
|
|
|
2015-05-28 14:13:37 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VToolPoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|
|
|
{
|
|
|
|
VDrawTool::SaveOptions(tag, obj);
|
|
|
|
|
|
|
|
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
|
|
|
|
SCASSERT(point.isNull() == false);
|
|
|
|
|
|
|
|
doc->SetAttribute(tag, AttrName, point->name());
|
|
|
|
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
|
|
|
|
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
|
|
|
}
|
|
|
|
|
2015-02-06 10:53:36 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VToolPoint::setEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
QGraphicsEllipseItem::setEnabled(enabled);
|
|
|
|
if (enabled)
|
|
|
|
{
|
|
|
|
setPen(QPen(QColor(baseColor), qApp->toPixel(qApp->widthHairLine())/factor));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setPen(QPen(Qt::gray, qApp->toPixel(qApp->widthHairLine())/factor));
|
|
|
|
}
|
|
|
|
}
|