QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
elementview.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 ELEMENT_VIEW_H
19#define ELEMENT_VIEW_H
20#include <QGraphicsView>
21#include "elementscene.h"
22
27class ElementView : public QGraphicsView {
28 Q_OBJECT
29 friend class PastePartsCommand;
30
31 // constructors, destructor
32 public:
33 ElementView(ElementScene *, QWidget * = nullptr);
34 ~ElementView() override;
35
36 private:
38
39 // methods
40 public:
41 ElementScene *scene() const;
42 void setScene(ElementScene *);
43 QRectF viewedSceneRect() const;
44
45 protected:
46 void mousePressEvent(QMouseEvent *) override;
47 void mouseMoveEvent(QMouseEvent *) override;
48 void mouseReleaseEvent(QMouseEvent *) override;
49 bool gestureEvent(QGestureEvent *event);
50 bool event(QEvent *event) override;
51 void wheelEvent(QWheelEvent *) override;
52 void drawBackground(QPainter *, const QRectF &) override;
53
54 private:
55 QRectF applyMovement(const QRectF &, const QPointF &);
56
57 public slots:
59 void setSelectionMode();
60 void zoomIn();
61 void zoomOut();
62 void zoomInSlowly();
63 void zoomOutSlowly();
64 void zoomFit();
65 void zoomReset();
66 void adjustSceneRect();
67 void resetSceneRect ();
68 void cut();
69 void copy();
70 void paste();
71 void pasteInArea();
72
73 signals:
76
77 private slots:
78 void getPasteArea(const QRectF &);
79 ElementContent pasteAreaDefined(const QRectF &);
80 ElementContent paste(const QPointF &);
81 ElementContent paste(const QDomDocument &, const QPointF &);
82 ElementContent pasteWithOffset(const QDomDocument &);
83
84 // attributes
85 private:
91 bool gestures() const;
92};
93#endif
The ElementScene class This class is the canvas allowing the visual edition of an electrical element....
Definition elementscene.h:46
Definition elementview.h:27
void mouseMoveEvent(QMouseEvent *) override
ElementView::mouseMoveEvent Manage the event move mouse.
Definition elementview.cpp:398
void zoomInSlowly()
Definition elementview.cpp:124
ElementScene * m_scene
Definition elementview.h:86
QString to_paste_in_area_
Definition elementview.h:87
void adjustSceneRect()
ElementView::adjustSceneRect Adjust the scenRect, so that he include all primitives of element plus t...
Definition elementview.cpp:163
ElementView(const ElementView &)
void zoomOutSlowly()
Definition elementview.cpp:132
void setVisualisationMode()
Definition elementview.cpp:86
void zoomFit()
Definition elementview.cpp:142
int offset_paste_count_
Definition elementview.h:88
void mousePressEvent(QMouseEvent *) override
Definition elementview.cpp:376
void drawBackground(QPainter *, const QRectF &) override
Definition elementview.cpp:511
void modeChanged()
Signal emitted after the mode changed.
bool gestureEvent(QGestureEvent *event)
ElementView::gestureEvent.
Definition elementview.cpp:490
QPointF start_top_left_corner_
Definition elementview.h:89
bool gestures() const
ElementView::gestures.
Definition elementview.cpp:446
void wheelEvent(QWheelEvent *) override
ElementView::wheelEvent.
Definition elementview.cpp:457
void mouseReleaseEvent(QMouseEvent *) override
ElementView::mouseReleaseEvent Manage event release click mouse.
Definition elementview.cpp:424
void setScene(ElementScene *)
Definition elementview.cpp:78
bool event(QEvent *event) override
Definition elementview.cpp:473
ElementContent pasteAreaDefined(const QRectF &)
Definition elementview.cpp:292
void cut()
Definition elementview.cpp:185
void zoomIn()
Definition elementview.cpp:106
QPointF reference_view_
Definition elementview.h:90
void resetSceneRect()
ElementView::resetSceneRect reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que...
Definition elementview.cpp:176
ElementScene * scene() const
Definition elementview.cpp:50
void getPasteArea(const QRectF &)
Definition elementview.cpp:275
QRectF viewedSceneRect() const
Definition elementview.cpp:58
ElementContent pasteWithOffset(const QDomDocument &)
Definition elementview.cpp:327
void paste()
Definition elementview.cpp:213
QRectF applyMovement(const QRectF &, const QPointF &)
ElementView::applyMovement Applique le decalage offset dans le sens movement au rectangle start.
Definition elementview.cpp:593
void copy()
Definition elementview.cpp:196
void zoomReset()
Definition elementview.cpp:151
void pasteInArea()
Definition elementview.cpp:238
void zoomOut()
Definition elementview.cpp:115
~ElementView() override
Destructeur.
Definition elementview.cpp:45
void setSelectionMode()
Definition elementview.cpp:96
The PastePartsCommand class Undo command for paste element primitive in an element editor.
Definition pastepartscommand.h:31
QList< QGraphicsItem * > ElementContent
Definition elementcontent.h:30