Refactoring.
--HG-- branch : feature
This commit is contained in:
parent
96c19190a0
commit
e30d1fe9dd
116
src/tools/drawTools/vabstractspline.cpp
Normal file
116
src/tools/drawTools/vabstractspline.cpp
Normal file
|
@ -0,0 +1,116 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vabstractspline.cpp
|
||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||
** @date 4 3, 2014
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** 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.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** 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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vabstractspline.h"
|
||||
|
||||
const QString VAbstractSpline::TagName = QStringLiteral("spline");
|
||||
|
||||
VAbstractSpline::VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
||||
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>())
|
||||
{
|
||||
ignoreFullUpdate = true;
|
||||
}
|
||||
|
||||
void VAbstractSpline::FullUpdateFromFile()
|
||||
{
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VAbstractSpline::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
bool selectable = false;
|
||||
if (nameActivDraw == newName)
|
||||
{
|
||||
selectable = true;
|
||||
currentColor = Qt::black;
|
||||
}
|
||||
else
|
||||
{
|
||||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
emit setEnabledPoint(selectable);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
void VAbstractSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
|
||||
{
|
||||
ShowItem(this, id, color, enable);
|
||||
}
|
||||
|
||||
void VAbstractSpline::SetFactor(qreal factor)
|
||||
{
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||
}
|
||||
|
||||
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
|
||||
QVariant VAbstractSpline::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);
|
||||
}
|
||||
|
||||
void VAbstractSpline::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Delete:
|
||||
DeleteTool(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QGraphicsItem::keyReleaseEvent ( event );
|
||||
}
|
112
src/tools/drawTools/vabstractspline.h
Normal file
112
src/tools/drawTools/vabstractspline.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vabstractspline.h
|
||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||
** @date 4 3, 2014
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** 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.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** 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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VABSTRACTSPLINE_H
|
||||
#define VABSTRACTSPLINE_H
|
||||
|
||||
#include "vdrawtool.h"
|
||||
#include <QGraphicsPathItem>
|
||||
#include "../../widgets/vcontrolpointspline.h"
|
||||
|
||||
class VAbstractSpline:public VDrawTool, public QGraphicsPathItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
|
||||
static const QString TagName;
|
||||
public slots:
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
*/
|
||||
virtual void FullUpdateFromFile ();
|
||||
signals:
|
||||
/**
|
||||
* @brief RefreshLine refresh control line.
|
||||
* @param indexSpline position spline in spline list.
|
||||
* @param position position point in spline.
|
||||
* @param controlPoint new position control point.
|
||||
* @param splinePoint new position spline point.
|
||||
*/
|
||||
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos,
|
||||
const QPointF &controlPoint, const QPointF &splinePoint);
|
||||
/**
|
||||
* @brief setEnabledPoint disable control points.
|
||||
* @param enable enable or diasable points.
|
||||
*/
|
||||
void setEnabledPoint(bool enable);
|
||||
protected:
|
||||
/**
|
||||
* @brief controlPoints list pointers of control points.
|
||||
*/
|
||||
QVector<VControlPointSpline *> controlPoints;
|
||||
/**
|
||||
* @brief RefreshGeometry refresh item on scene.
|
||||
*/
|
||||
virtual void RefreshGeometry ()=0;
|
||||
/**
|
||||
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
|
||||
* @param newName new name active pattern peace.
|
||||
*/
|
||||
virtual void ChangedActivDraw ( const QString &newName );
|
||||
/**
|
||||
* @brief ShowTool highlight tool.
|
||||
* @param id object id in container
|
||||
* @param color highlight color.
|
||||
* @param enable enable or disable highlight.
|
||||
*/
|
||||
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||
/**
|
||||
* @brief SetFactor set current scale factor of scene.
|
||||
* @param factor scene scale factor.
|
||||
*/
|
||||
virtual void SetFactor(qreal factor);
|
||||
/**
|
||||
* @brief hoverMoveEvent handle hover move events.
|
||||
* @param event hover move event.
|
||||
*/
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief hoverLeaveEvent handle hover leave events.
|
||||
* @param event hover leave event.
|
||||
*/
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief itemChange hadle item change.
|
||||
* @param change change.
|
||||
* @param value value.
|
||||
* @return value.
|
||||
*/
|
||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||
/**
|
||||
* @brief keyReleaseEvent handle key release events.
|
||||
* @param event key release event.
|
||||
*/
|
||||
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||
};
|
||||
|
||||
#endif // VABSTRACTSPLINE_H
|
|
@ -30,15 +30,11 @@
|
|||
#include "../../geometry/vspline.h"
|
||||
#include "../../dialogs/tools/dialogspline.h"
|
||||
|
||||
const QString VToolSpline::TagName = QStringLiteral("spline");
|
||||
const QString VToolSpline::ToolType = QStringLiteral("simple");
|
||||
|
||||
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>())
|
||||
QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent)
|
||||
{
|
||||
ignoreFullUpdate = true;
|
||||
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(id);
|
||||
QPainterPath path;
|
||||
path.addPath(spl->GetPath());
|
||||
|
@ -144,11 +140,6 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4
|
|||
}
|
||||
}
|
||||
|
||||
void VToolSpline::FullUpdateFromFile()
|
||||
{
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position,
|
||||
const QPointF &pos)
|
||||
{
|
||||
|
@ -224,18 +215,6 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void VToolSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSpline::RemoveReferens()
|
||||
{
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
|
@ -243,37 +222,6 @@ void VToolSpline::RemoveReferens()
|
|||
doc->DecrementReferens(spl->GetP4().id());
|
||||
}
|
||||
|
||||
QVariant VToolSpline::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);
|
||||
}
|
||||
|
||||
void VToolSpline::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Delete:
|
||||
DeleteTool(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QGraphicsItem::keyReleaseEvent ( event );
|
||||
}
|
||||
|
||||
void VToolSpline::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
|
@ -333,35 +281,3 @@ void VToolSpline::RefreshGeometry()
|
|||
connect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSpline::ControlPointChangePosition);
|
||||
}
|
||||
|
||||
|
||||
void VToolSpline::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
bool selectable = false;
|
||||
if (nameActivDraw == newName)
|
||||
{
|
||||
selectable = true;
|
||||
currentColor = Qt::black;
|
||||
}
|
||||
else
|
||||
{
|
||||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
emit setEnabledPoint(selectable);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
void VToolSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
|
||||
{
|
||||
ShowItem(this, id, color, enable);
|
||||
}
|
||||
|
||||
void VToolSpline::SetFactor(qreal factor)
|
||||
{
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -29,15 +29,13 @@
|
|||
#ifndef VTOOLSPLINE_H
|
||||
#define VTOOLSPLINE_H
|
||||
|
||||
#include "vdrawtool.h"
|
||||
#include <QGraphicsPathItem>
|
||||
#include "../../widgets/vcontrolpointspline.h"
|
||||
#include "vabstractspline.h"
|
||||
#include "../../geometry/vsplinepath.h"
|
||||
|
||||
/**
|
||||
* @brief The VToolSpline class tool for creation spline. I mean bezier curve.
|
||||
*/
|
||||
class VToolSpline:public VDrawTool, public QGraphicsPathItem
|
||||
class VToolSpline:public VAbstractSpline
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -83,28 +81,8 @@ public:
|
|||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
signals:
|
||||
/**
|
||||
* @brief RefreshLine refresh control line.
|
||||
* @param indexSpline position spline in spline list.
|
||||
* @param position position point in spline.
|
||||
* @param controlPoint new position control point.
|
||||
* @param splinePoint new position spline point.
|
||||
*/
|
||||
void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position,
|
||||
const QPointF &controlPoint, const QPointF &splinePoint );
|
||||
/**
|
||||
* @brief setEnabledPoint disable control points.
|
||||
* @param enable enable or diasable points.
|
||||
*/
|
||||
void setEnabledPoint ( bool enable );
|
||||
public slots:
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
*/
|
||||
virtual void FullUpdateFromFile ();
|
||||
/**
|
||||
* @brief ControlPointChangePosition handle change position control point.
|
||||
* @param indexSpline position spline in spline list.
|
||||
|
@ -113,23 +91,6 @@ public slots:
|
|||
*/
|
||||
void ControlPointChangePosition (const qint32 &indexSpline, const SplinePoint::Position &position,
|
||||
const QPointF &pos);
|
||||
/**
|
||||
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
|
||||
* @param newName new name active pattern peace.
|
||||
*/
|
||||
virtual void ChangedActivDraw ( const QString &newName );
|
||||
/**
|
||||
* @brief ShowTool highlight tool.
|
||||
* @param id object id in container
|
||||
* @param color highlight color.
|
||||
* @param enable enable or disable highlight.
|
||||
*/
|
||||
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||
/**
|
||||
* @brief SetFactor set current scale factor of scene.
|
||||
* @param factor scene scale factor.
|
||||
*/
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
/**
|
||||
* @brief contextMenuEvent handle context menu events.
|
||||
|
@ -149,41 +110,15 @@ protected:
|
|||
* @param event context menu event.
|
||||
*/
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||
/**
|
||||
* @brief hoverMoveEvent handle hover move events.
|
||||
* @param event hover move event.
|
||||
*/
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief hoverLeaveEvent handle hover leave events.
|
||||
* @param event hover leave event.
|
||||
*/
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief RemoveReferens decrement value of reference.
|
||||
*/
|
||||
virtual void RemoveReferens();
|
||||
/**
|
||||
* @brief itemChange hadle item change.
|
||||
* @param change change.
|
||||
* @param value value.
|
||||
* @return value.
|
||||
*/
|
||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||
/**
|
||||
* @brief keyReleaseEvent handle key release events.
|
||||
* @param event key release event.
|
||||
*/
|
||||
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||
/**
|
||||
* @brief SaveDialog save options into file after change in dialog.
|
||||
*/
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
private:
|
||||
/**
|
||||
* @brief controlPoints list pointers of control points.
|
||||
*/
|
||||
QVector<VControlPointSpline *> controlPoints;
|
||||
/**
|
||||
* @brief RefreshGeometry refresh item on scene.
|
||||
*/
|
||||
|
|
|
@ -29,14 +29,11 @@
|
|||
#include "vtoolsplinepath.h"
|
||||
#include "../../dialogs/tools/dialogsplinepath.h"
|
||||
|
||||
const QString VToolSplinePath::TagName = QStringLiteral("spline");
|
||||
const QString VToolSplinePath::ToolType = QStringLiteral("path");
|
||||
|
||||
VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>())
|
||||
QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent)
|
||||
{
|
||||
ignoreFullUpdate = true;
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(id);
|
||||
QPainterPath path;
|
||||
path.addPath(splPath->GetPath());
|
||||
|
@ -128,11 +125,6 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics
|
|||
}
|
||||
}
|
||||
|
||||
void VToolSplinePath::FullUpdateFromFile()
|
||||
{
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position,
|
||||
const QPointF &pos)
|
||||
{
|
||||
|
@ -213,37 +205,6 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path)
|
|||
}
|
||||
}
|
||||
|
||||
void VToolSplinePath::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
bool selectable = false;
|
||||
if (nameActivDraw == newName)
|
||||
{
|
||||
selectable = true;
|
||||
currentColor = Qt::black;
|
||||
}
|
||||
else
|
||||
{
|
||||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
emit setEnabledPoint(selectable);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
void VToolSplinePath::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
|
||||
{
|
||||
ShowItem(this, id, color, enable);
|
||||
}
|
||||
|
||||
void VToolSplinePath::SetFactor(qreal factor)
|
||||
{
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
ContextMenu<DialogSplinePath>(this, event);
|
||||
|
@ -301,18 +262,6 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void VToolSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSplinePath::RemoveReferens()
|
||||
{
|
||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||
|
@ -322,37 +271,6 @@ void VToolSplinePath::RemoveReferens()
|
|||
}
|
||||
}
|
||||
|
||||
QVariant VToolSplinePath::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);
|
||||
}
|
||||
|
||||
void VToolSplinePath::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Delete:
|
||||
DeleteTool(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QGraphicsItem::keyReleaseEvent ( event );
|
||||
}
|
||||
|
||||
void VToolSplinePath::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
Q_CHECK_PTR(dialog);
|
||||
|
|
|
@ -29,14 +29,12 @@
|
|||
#ifndef VTOOLSPLINEPATH_H
|
||||
#define VTOOLSPLINEPATH_H
|
||||
|
||||
#include "vdrawtool.h"
|
||||
#include <QGraphicsPathItem>
|
||||
#include "../../widgets/vcontrolpointspline.h"
|
||||
#include "vabstractspline.h"
|
||||
|
||||
/**
|
||||
* @brief The VToolSplinePath class tool for creation spline path.
|
||||
*/
|
||||
class VToolSplinePath:public VDrawTool, public QGraphicsPathItem
|
||||
class VToolSplinePath:public VAbstractSpline
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -75,7 +73,6 @@ public:
|
|||
static void Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document::Documents &parse,
|
||||
const Tool::Sources &typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
signals:
|
||||
/**
|
||||
|
@ -93,10 +90,6 @@ signals:
|
|||
*/
|
||||
void setEnabledPoint(bool enable);
|
||||
public slots:
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
*/
|
||||
virtual void FullUpdateFromFile();
|
||||
/**
|
||||
* @brief ControlPointChangePosition handle change position control point.
|
||||
* @param indexSpline position spline in spline list.
|
||||
|
@ -105,23 +98,6 @@ public slots:
|
|||
*/
|
||||
void ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position,
|
||||
const QPointF &pos);
|
||||
/**
|
||||
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
|
||||
* @param newName new name active pattern peace.
|
||||
*/
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
/**
|
||||
* @brief ShowTool highlight tool.
|
||||
* @param id object id in container
|
||||
* @param color highlight color.
|
||||
* @param enable enable or disable highlight.
|
||||
*/
|
||||
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||
/**
|
||||
* @brief SetFactor set current scale factor of scene.
|
||||
* @param factor scene scale factor.
|
||||
*/
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
/**
|
||||
* @brief contextMenuEvent handle context menu events.
|
||||
|
@ -141,41 +117,15 @@ protected:
|
|||
* @param event mouse release event.
|
||||
*/
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||
/**
|
||||
* @brief hoverMoveEvent handle hover move events.
|
||||
* @param event hover move event.
|
||||
*/
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief hoverLeaveEvent handle hover leave events.
|
||||
* @param event hover leave event.
|
||||
*/
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief RemoveReferens decrement value of reference.
|
||||
*/
|
||||
virtual void RemoveReferens();
|
||||
/**
|
||||
* @brief itemChange handle item change.
|
||||
* @param change change.
|
||||
* @param value value.
|
||||
* @return value.
|
||||
*/
|
||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||
/**
|
||||
* @brief keyReleaseEvent handle key release events.
|
||||
* @param event key release event.
|
||||
*/
|
||||
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||
/**
|
||||
* @brief SaveDialog save options into file after change in dialog.
|
||||
*/
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
private:
|
||||
/**
|
||||
* @brief controlPoints list pointers of control points.
|
||||
*/
|
||||
QVector<VControlPointSpline *> controlPoints;
|
||||
/**
|
||||
* @brief RefreshGeometry refresh item on scene.
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,8 @@ HEADERS += \
|
|||
src/tools/drawTools/vtoolcutspline.h \
|
||||
src/tools/drawTools/vtoolcutsplinepath.h \
|
||||
src/tools/vtooluniondetails.h \
|
||||
src/tools/drawTools/vtoolcutarc.h
|
||||
src/tools/drawTools/vtoolcutarc.h \
|
||||
src/tools/drawTools/vabstractspline.h
|
||||
|
||||
SOURCES += \
|
||||
src/tools/vtooldetail.cpp \
|
||||
|
@ -63,4 +64,5 @@ SOURCES += \
|
|||
src/tools/drawTools/vtoolcutspline.cpp \
|
||||
src/tools/drawTools/vtoolcutsplinepath.cpp \
|
||||
src/tools/vtooluniondetails.cpp \
|
||||
src/tools/drawTools/vtoolcutarc.cpp
|
||||
src/tools/drawTools/vtoolcutarc.cpp \
|
||||
src/tools/drawTools/vabstractspline.cpp
|
||||
|
|
Loading…
Reference in New Issue
Block a user