QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
partellipse.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef PART_ELLIPSE_H
19#define PART_ELLIPSE_H
20
21#include "abstractpartellipse.h"
22
24
31{
32 Q_OBJECT
33
34 // constructors, destructor
35 public:
36 PartEllipse(QETElementEditor *editor, QGraphicsItem * parent = nullptr);
37 ~PartEllipse() override;
38
39 private:
41
42 signals:
44
45 // methods
46 public:
47 enum { Type = UserType + 1103 };
52 int type() const override { return Type; }
53 void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = nullptr) override;
54
55 //Name and XML
56 QString name() const override { return(QObject::tr("ellipse", "element part name")); }
57 QString xmlName() const override { return(QString("ellipse")); }
58 const QDomElement toXml (QDomDocument &) const override;
59 void fromXml (const QDomElement &) override;
60 QPainterPath shape() const override;
61 QPainterPath shadowShape() const override;
63 void setRotation(qreal angle);
64 qreal rotation() const;
65 void flip(qreal axis_y = 0);
66 void mirror(qreal axis_x = 0);
67
68 void addHandler() override;
69 void removeHandler() override;
70
71 protected:
72 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
73 QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
74 bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override;
75
76 private:
77 void switchResizeMode();
78 void adjustHandlerPos();
79 void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
80 void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
81 void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
82
83 private:
87 qreal m_rot = 0;
88};
89#endif
QRectF rect
Definition abstractpartellipse.h:44
virtual void setRect(const QRectF &rect)
AbstractPartEllipse::setRect Sets the item's ellipse geometry to rect. The rectangle's left edge defi...
Definition abstractpartellipse.cpp:122
AbstractPartEllipse(QETElementEditor *editor, QGraphicsItem *parent=nullptr)
AbstractPartEllipse::AbstractPartEllipse Constructor.
Definition abstractpartellipse.cpp:26
~PartEllipse() override
PartEllipse::~PartEllipse Destructor.
Definition partellipse.cpp:40
void removeHandler() override
PartEllipse::removeHandler Remove the handlers of this item.
Definition partellipse.cpp:398
PartEllipse(const PartEllipse &)
int m_resize_mode
Definition partellipse.h:85
const QDomElement toXml(QDomDocument &) const override
PartEllipse::toXml Export this ellipse in xml.
Definition partellipse.cpp:80
void setRotation(qreal angle)
Definition partellipse.cpp:233
qreal m_rot
Definition partellipse.h:87
void rotationChanged()
void addHandler() override
PartEllipse::addHandler Add handlers for this item.
Definition partellipse.cpp:374
void handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
PartEllipse::handlerMousePressEvent.
Definition partellipse.cpp:321
QPropertyUndoCommand * m_undo_command
Definition partellipse.h:84
QString name() const override
Definition partellipse.h:56
int type() const override
Definition partellipse.h:52
PartEllipse(QETElementEditor *editor, QGraphicsItem *parent=nullptr)
PartEllipse::PartEllipse Constructor.
Definition partellipse.cpp:31
void adjustHandlerPos()
PartEllipse::adjustHandlerPos.
Definition partellipse.cpp:301
void switchResizeMode()
Definition partellipse.cpp:282
qreal rotation() const
Definition partellipse.cpp:255
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
PartEllipse::itemChange.
Definition partellipse.cpp:178
@ Type
Definition partellipse.h:47
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override
PartEllipse::sceneEventFilter.
Definition partellipse.cpp:198
QPainterPath shape() const override
PartEllipse::shape.
Definition partellipse.cpp:136
QPainterPath shadowShape() const override
Definition partellipse.cpp:148
void fromXml(const QDomElement &) override
PartEllipse::fromXml Import the properties of this ellipse from a xml element.
Definition partellipse.cpp:114
QString xmlName() const override
Definition partellipse.h:57
void handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
PartEllipse::handlerMouseReleaseEvent.
Definition partellipse.cpp:359
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
PartEllipse::mouseReleaseEvent Handle mouse release event.
Definition partellipse.cpp:164
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *=nullptr) override
PartEllipse::paint Draw this ellpise.
Definition partellipse.cpp:53
void mirror(qreal axis_x=0)
Definition partellipse.cpp:269
void handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
PartEllipse::handlerMouseMoveEvent.
Definition partellipse.cpp:337
int m_vector_index
Definition partellipse.h:86
void setRect(const QRectF &rect) override
AbstractPartEllipse::setRect Sets the item's ellipse geometry to rect. The rectangle's left edge defi...
Definition partellipse.h:62
void flip(qreal axis_y=0)
Definition partellipse.cpp:259
Definition qetelementeditor.h:39
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition qpropertyundocommand.h:34
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
Definition qetgraphicshandleritem.h:37