diff --git a/src/app/tools/drawTools/vtoolcutarc.cpp b/src/app/tools/drawTools/vtoolcutarc.cpp index 8c0571a36..ffced0409 100644 --- a/src/app/tools/drawTools/vtoolcutarc.cpp +++ b/src/app/tools/drawTools/vtoolcutarc.cpp @@ -58,15 +58,15 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con Q_ASSERT_X(arc1id > 0, Q_FUNC_INFO, "arc1id <= 0"); Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0"); - firstArc = new VSimpleArc(arc1id, ¤tColor, &factor); - RefreshArc(firstArc, arc1id, SimpleArcPoint::ForthPoint); + firstArc = new VSimpleCurve(arc1id, ¤tColor, &factor); + RefreshArc(firstArc, arc1id, SimpleCurvePoint::ForthPoint); firstArc->setParentItem(this); - connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); + connect(firstArc, &VSimpleCurve::Choosed, this, &VToolCutArc::ArcChoosed); - secondArc = new VSimpleArc(arc2id, ¤tColor, &factor); - RefreshArc(secondArc, arc2id, SimpleArcPoint::FirstPoint); + secondArc = new VSimpleCurve(arc2id, ¤tColor, &factor); + RefreshArc(secondArc, arc2id, SimpleCurvePoint::FirstPoint); secondArc->setParentItem(this); - connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); + connect(secondArc, &VSimpleCurve::Choosed, this, &VToolCutArc::ArcChoosed); if (typeCreation == Source::FromGui) { @@ -311,8 +311,8 @@ void VToolCutArc::RefreshDataInFile() */ void VToolCutArc::RefreshGeometry() { - RefreshArc(firstArc, arc1id, SimpleArcPoint::ForthPoint); - RefreshArc(secondArc, arc2id, SimpleArcPoint::FirstPoint); + RefreshArc(firstArc, arc1id, SimpleCurvePoint::ForthPoint); + RefreshArc(secondArc, arc2id, SimpleCurvePoint::FirstPoint); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(id)); } @@ -337,13 +337,13 @@ void VToolCutArc::SaveDialog(QDomElement &domElement) * @param arcid arc id. * @param tr arc type. */ -void VToolCutArc::RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArcPoint tr) +void VToolCutArc::RefreshArc(VSimpleCurve *sArc, quint32 arcid, SimpleCurvePoint tr) { const VArc *arc = VAbstractTool::data.GeometricObject(arcid); QPainterPath path; path.addPath(arc->GetPath()); path.setFillRule( Qt::WindingFill ); - if (tr == SimpleArcPoint::FirstPoint) + if (tr == SimpleCurvePoint::FirstPoint) { path.translate(-arc->GetP1().x(), -arc->GetP1().y()); } diff --git a/src/app/tools/drawTools/vtoolcutarc.h b/src/app/tools/drawTools/vtoolcutarc.h index 978ce5a74..4c8def43d 100644 --- a/src/app/tools/drawTools/vtoolcutarc.h +++ b/src/app/tools/drawTools/vtoolcutarc.h @@ -30,7 +30,7 @@ #define VTOOLCUTARC_H #include "vtoolpoint.h" -#include "../../widgets/vsimplearc.h" +#include "../../widgets/vsimplecurve.h" /** * @brief The VToolCutArc class tool for cutting arc. @@ -70,17 +70,17 @@ private: quint32 arcId; /** @brief firstArc first arc after cutting. */ - VSimpleArc *firstArc; + VSimpleCurve *firstArc; /** @brief secondArc second arc after cutting. */ - VSimpleArc *secondArc; + VSimpleCurve *secondArc; /** @brief arc1id id first arc after cutting. */ const quint32 arc1id; /** @brief arc2id id second arc after cutting. */ const quint32 arc2id; - void RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArcPoint tr); + void RefreshArc(VSimpleCurve *sArc, quint32 arcid, SimpleCurvePoint tr); }; #endif // VTOOLCUTARC_H diff --git a/src/app/widgets/vsimplearc.cpp b/src/app/widgets/vsimplearc.cpp deleted file mode 100644 index ea5692f36..000000000 --- a/src/app/widgets/vsimplearc.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************ - ** - ** @file vsimplearc.cpp - ** @author Roman Telezhynskyi - ** @date 7 1, 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 - ** 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 . - ** - *************************************************************************/ - -#include "vsimplearc.h" -#include "../widgets/vapplication.h" -#include -#include - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VSimpleArc constructor. - * @param id arc id. - * @param currentColor current color. - * @param factor scale factor. - * @param parent parent object. - */ -VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) - :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) -{ - if (factor == nullptr) - { - setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()))); - } - else - { - setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/ *factor)); - } - setFlag(QGraphicsItem::ItemIsSelectable, true); - setAcceptHoverEvents(true); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VSimpleArc::ChangedActivDraw(const bool &flag) -{ - setFlag(QGraphicsItem::ItemIsSelectable, flag); - setAcceptHoverEvents(flag); - setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor)); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief mouseReleaseEvent handle mouse release events. - * @param event mouse release event. - */ -void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - { - emit Choosed(id); - } - QGraphicsItem::mouseReleaseEvent(event); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief hoverMoveEvent handle hover move events. - * @param event hover move event. - */ -void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - if (factor == nullptr) - { - this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthMainLine()))); - } - else - { - this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthMainLine())/ *factor)); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief hoverLeaveEvent handle hover leave events. - * @param event hover leave event. - */ -void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - if (factor == nullptr) - { - this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine()))); - } - else - { - this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor)); - } -} diff --git a/src/app/widgets/vsimplearc.h b/src/app/widgets/vsimplearc.h deleted file mode 100644 index 09792ae5e..000000000 --- a/src/app/widgets/vsimplearc.h +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************ - ** - ** @file vsimplearc.h - ** @author Roman Telezhynskyi - ** @date 7 1, 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 - ** 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 . - ** - *************************************************************************/ - -#ifndef VSIMPLEARC_H -#define VSIMPLEARC_H - -#include - -enum class SimpleArcPoint : char { FirstPoint, ForthPoint }; - -/** - * @brief The VSimpleArc class for simple arc. This object used when we cut arc and want show peaces. - */ -class VSimpleArc : public QObject, public QGraphicsPathItem -{ - Q_OBJECT -public: - VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = nullptr); - void ChangedActivDraw(const bool &flag); -signals: - /** - * @brief Choosed send id when clicked. - * @param id arc id. - */ - void Choosed(quint32 id); -protected: - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); -private: - Q_DISABLE_COPY(VSimpleArc) - /** @brief id arc id. */ - quint32 id; - - /** @brief factor scale factor. */ - qreal *factor; - - /** @brief currentColor current color. */ - Qt::GlobalColor *currentColor; -}; - -#endif // VSIMPLEARC_H diff --git a/src/app/widgets/widgets.pri b/src/app/widgets/widgets.pri index 50d963761..901d6341d 100644 --- a/src/app/widgets/widgets.pri +++ b/src/app/widgets/widgets.pri @@ -8,7 +8,6 @@ HEADERS += \ widgets/vapplication.h \ widgets/doubledelegate.h \ widgets/vsimplesplinepath.h \ - widgets/vsimplearc.h \ widgets/textdelegate.h \ widgets/vtranslation.h \ widgets/undoevent.h \ @@ -24,7 +23,6 @@ SOURCES += \ widgets/vapplication.cpp \ widgets/doubledelegate.cpp \ widgets/vsimplesplinepath.cpp \ - widgets/vsimplearc.cpp \ widgets/textdelegate.cpp \ widgets/vtranslation.cpp \ widgets/undoevent.cpp \