QElectroTech  0.70
Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | Friends | List of all members
ElementView Class Reference

#include <elementview.h>

Public Slots

void setVisualisationMode ()
 
void setSelectionMode ()
 
void zoomIn ()
 
void zoomOut ()
 
void zoomInSlowly ()
 
void zoomOutSlowly ()
 
void zoomFit ()
 
void zoomReset ()
 
void adjustSceneRect ()
 ElementView::adjustSceneRect Adjust the scenRect, so that he include all primitives of element plus the viewport of the scene with a margin of 1/3 of herself. More...
 
void resetSceneRect ()
 ElementView::resetSceneRect reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que celui-ci inclut uniquement les primitives de l'élément dessiné. More...
 
void cut ()
 
void copy ()
 
void paste ()
 
void pasteInArea ()
 

Signals

void modeChanged ()
 Signal emitted after the mode changed. More...
 

Public Member Functions

 ElementView (ElementScene *, QWidget *=nullptr)
 
 ~ElementView () override
 Destructeur. More...
 
ElementScenescene () const
 
void setScene (ElementScene *)
 
QRectF viewedSceneRect () const
 

Protected Member Functions

void mousePressEvent (QMouseEvent *) override
 
void mouseMoveEvent (QMouseEvent *) override
 ElementView::mouseMoveEvent Manage the event move mouse. More...
 
void mouseReleaseEvent (QMouseEvent *) override
 ElementView::mouseReleaseEvent Manage event release click mouse. More...
 
bool gestureEvent (QGestureEvent *event)
 ElementView::gestureEvent. More...
 
bool event (QEvent *event) override
 
void wheelEvent (QWheelEvent *) override
 ElementView::wheelEvent. More...
 
void drawBackground (QPainter *, const QRectF &) override
 

Private Slots

void getPasteArea (const QRectF &)
 
ElementContent pasteAreaDefined (const QRectF &)
 
ElementContent paste (const QPointF &)
 
ElementContent paste (const QDomDocument &, const QPointF &)
 
ElementContent pasteWithOffset (const QDomDocument &)
 

Private Member Functions

 ElementView (const ElementView &)
 
QRectF applyMovement (const QRectF &, const QPointF &)
 
bool gestures () const
 ElementView::gestures. More...
 

Private Attributes

ElementScenem_scene
 
QString to_paste_in_area_
 
int offset_paste_count_
 
QPointF start_top_left_corner_
 
QPointF reference_view_
 

Friends

class PastePartsCommand
 

Detailed Description

This class provides a widget to render an ElementScene instance, i.e. the edition class for electrical elements.

Definition at line 27 of file elementview.h.

Constructor & Destructor Documentation

◆ ElementView() [1/2]

ElementView::ElementView ( ElementScene scene,
QWidget *  parent = nullptr 
)

Constructeur

Parameters
sceneElementScene visualisee par cette ElementView
parentQWidget parent de cette ElementView

Definition at line 27 of file elementview.cpp.

References m_scene, pasteAreaDefined(), zoomFit(), and zoomReset().

◆ ~ElementView()

ElementView::~ElementView ( )
override

Destructeur.

Definition at line 44 of file elementview.cpp.

◆ ElementView() [2/2]

ElementView::ElementView ( const ElementView )
private

Member Function Documentation

◆ adjustSceneRect

void ElementView::adjustSceneRect ( )
slot

ElementView::adjustSceneRect Adjust the scenRect, so that he include all primitives of element plus the viewport of the scene with a margin of 1/3 of herself.

Definition at line 151 of file elementview.cpp.

References m_scene.

Referenced by mouseReleaseEvent(), zoomIn(), and zoomOut().

◆ applyMovement()

QRectF ElementView::applyMovement ( const QRectF &  start,
const QPointF &  offset 
)
private

Applique le decalage offset dans le sens movement au rectangle start

Parameters
startrectangle a decaler
movementOrientation du decalage a appliquer
offsetDecalage a appliquer

Definition at line 547 of file elementview.cpp.

Referenced by pasteWithOffset().

◆ copy

void ElementView::copy ( )
slot

Gere le fait de copier la selection = l'exporter en XML dans le presse-papier.

Definition at line 181 of file elementview.cpp.

References m_scene, and offset_paste_count_.

◆ cut

void ElementView::cut ( )
slot

Gere le fait de couper la selection = l'exporter en XML dans le presse-papier puis la supprimer.

Definition at line 171 of file elementview.cpp.

References m_scene, and offset_paste_count_.

◆ drawBackground()

void ElementView::drawBackground ( QPainter *  p,
const QRectF &  r 
)
overrideprotected

Dessine l'arriere-plan de l'editeur, cad la grille.

Parameters
pLe QPainter a utiliser pour dessiner
rLe rectangle de la zone a dessiner

Definition at line 468 of file elementview.cpp.

References m_scene, and ElementScene::setGrid().

◆ event()

bool ElementView::event ( QEvent *  e)
overrideprotected

Gere les evenements de la ElementView

Parameters
eEvenement

Definition at line 430 of file elementview.cpp.

References gestureEvent().

Referenced by gestureEvent().

◆ gestureEvent()

bool ElementView::gestureEvent ( QGestureEvent *  event)
protected

ElementView::gestureEvent.

Utilise le pincement du trackpad pour zoomer

Parameters
event
Returns

Definition at line 447 of file elementview.cpp.

References event(), zoomInSlowly(), and zoomOutSlowly().

Referenced by event().

◆ gestures()

bool ElementView::gestures ( ) const
private

ElementView::gestures.

Returns

Definition at line 403 of file elementview.cpp.

Referenced by wheelEvent().

◆ getPasteArea

void ElementView::getPasteArea ( const QRectF &  to_paste)
privateslot
Parameters
to_pasteRectangle englobant les parties a coller

Definition at line 257 of file elementview.cpp.

References m_scene.

Referenced by paste(), and pasteInArea().

◆ modeChanged

void ElementView::modeChanged ( )
signal

Signal emitted after the mode changed.

Referenced by setSelectionMode(), and setVisualisationMode().

◆ mouseMoveEvent()

void ElementView::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

ElementView::mouseMoveEvent Manage the event move mouse.

Definition at line 372 of file elementview.cpp.

References reference_view_.

◆ mousePressEvent()

void ElementView::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Gere les clics sur la vue - permet de coller lorsaue l'on enfonce le bouton du milieu de la souris.

Parameters
eQMouseEvent decrivant l'evenement souris

Definition at line 358 of file elementview.cpp.

References reference_view_.

◆ mouseReleaseEvent()

void ElementView::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

ElementView::mouseReleaseEvent Manage event release click mouse.

Definition at line 390 of file elementview.cpp.

References adjustSceneRect().

◆ paste [1/3]

void ElementView::paste ( )
slot

Gere le fait de coller le contenu du presse-papier = l'importer dans l'element. Cette methode examine le contenu du presse-papier. Si celui-ci semble avoir ete copie depuis cet element, il est colle a cote de sa zone d'origine ; s'il est recolle, il sera colle un cran a cote de la zone deja recollee, etc. Sinon, cette methode demande a l'utilisateur de definir la zone ou le collage devra s'effectuer.

See also
pasteAreaDefined(const QRectF &)

Definition at line 197 of file elementview.cpp.

References getPasteArea(), m_scene, pasteWithOffset(), and to_paste_in_area_.

Referenced by paste(), and pasteAreaDefined().

◆ paste [2/3]

ElementContent ElementView::paste ( const QPointF &  position)
privateslot

Gere le fait de coller le contenu du presse-papier = l'importer dans l'element. Cette methode examine le contenu du presse-papier. Si celui-ci est exploitable, elle le colle a la position passee en parametre.

See also
pasteAreaDefined(const QRectF &)
Parameters
positionPoint de collage

Definition at line 243 of file elementview.cpp.

References paste().

◆ paste [3/3]

ElementContent ElementView::paste ( const QDomDocument &  xml_document,
const QPointF &  pos 
)
privateslot

Colle le document XML xml_document a la position pos

Parameters
xml_documentDocument XML a coller
posCoin superieur gauche du rectangle cible

Definition at line 291 of file elementview.cpp.

References m_scene, and PastePartsCommand.

◆ pasteAreaDefined

ElementContent ElementView::pasteAreaDefined ( const QRectF &  target_rect)
privateslot

Slot appele lorsque la scene annonce avoir defini une zone de collage

Parameters
target_rectRectangle cible pour le collage

Definition at line 274 of file elementview.cpp.

References paste(), and to_paste_in_area_.

Referenced by ElementView().

◆ pasteInArea

void ElementView::pasteInArea ( )
slot

Colle le contenu du presse-papier en demandant systematiquement a l'utilisateur de choisir une zone de collage

Definition at line 221 of file elementview.cpp.

References getPasteArea(), m_scene, and to_paste_in_area_.

◆ pasteWithOffset

ElementContent ElementView::pasteWithOffset ( const QDomDocument &  xml_document)
privateslot

Colle le document XML xml_document a la position pos

Parameters
xml_documentDocument XML a coller

Definition at line 309 of file elementview.cpp.

References applyMovement(), m_scene, offset_paste_count_, QETElementEditor::pasteOffset(), PastePartsCommand, and start_top_left_corner_.

Referenced by paste().

◆ resetSceneRect

void ElementView::resetSceneRect ( )
slot

ElementView::resetSceneRect reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que celui-ci inclut uniquement les primitives de l'élément dessiné.

Definition at line 163 of file elementview.cpp.

References m_scene.

Referenced by zoomFit(), and zoomReset().

◆ scene()

ElementScene * ElementView::scene ( ) const
Returns
l'ElementScene visualisee par cette ElementView

Definition at line 48 of file elementview.cpp.

References m_scene.

◆ setScene()

void ElementView::setScene ( ElementScene s)

Definit l'ElementScene visualisee par cette ElementView

Parameters
sl'ElementScene visualisee par cette ElementView

Definition at line 74 of file elementview.cpp.

References m_scene.

◆ setSelectionMode

void ElementView::setSelectionMode ( )
slot

Set the Diagram in Selection mode

Definition at line 91 of file elementview.cpp.

References modeChanged().

◆ setVisualisationMode

void ElementView::setVisualisationMode ( )
slot

Set the Diagram in visualisation mode

Definition at line 82 of file elementview.cpp.

References modeChanged().

◆ viewedSceneRect()

QRectF ElementView::viewedSceneRect ( ) const
Returns
le rectangle de l'element visualise par cet ElementView

Definition at line 55 of file elementview.cpp.

◆ wheelEvent()

void ElementView::wheelEvent ( QWheelEvent *  e)
overrideprotected

ElementView::wheelEvent.

Parameters
e

Definition at line 414 of file elementview.cpp.

References gestures(), zoomIn(), zoomInSlowly(), zoomOut(), and zoomOutSlowly().

◆ zoomFit

void ElementView::zoomFit ( )
slot

Agrandit ou rectrecit le schema de facon a ce que tous les elements du schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema, le zoom est reinitialise

Definition at line 132 of file elementview.cpp.

References resetSceneRect().

Referenced by ElementView().

◆ zoomIn

void ElementView::zoomIn ( )
slot

Agrandit le schema (+33% = inverse des -25 % de zoomMoins())

Definition at line 100 of file elementview.cpp.

References adjustSceneRect().

Referenced by wheelEvent().

◆ zoomInSlowly

void ElementView::zoomInSlowly ( )
slot

Agrandit le schema avec le trackpad

Definition at line 116 of file elementview.cpp.

Referenced by gestureEvent(), and wheelEvent().

◆ zoomOut

void ElementView::zoomOut ( )
slot

Retrecit le schema (-25% = inverse des +33 % de zoomPlus())

Definition at line 108 of file elementview.cpp.

References adjustSceneRect().

Referenced by wheelEvent().

◆ zoomOutSlowly

void ElementView::zoomOutSlowly ( )
slot

Retrecit le schema avec le trackpad

Definition at line 123 of file elementview.cpp.

Referenced by gestureEvent(), and wheelEvent().

◆ zoomReset

void ElementView::zoomReset ( )
slot

Reinitialise le zoom

Definition at line 140 of file elementview.cpp.

References resetSceneRect().

Referenced by ElementView().

Friends And Related Function Documentation

◆ PastePartsCommand

friend class PastePartsCommand
friend

Definition at line 29 of file elementview.h.

Referenced by paste(), and pasteWithOffset().

Member Data Documentation

◆ m_scene

ElementScene* ElementView::m_scene
private

◆ offset_paste_count_

int ElementView::offset_paste_count_
private

Definition at line 88 of file elementview.h.

Referenced by copy(), cut(), and pasteWithOffset().

◆ reference_view_

QPointF ElementView::reference_view_
private

Definition at line 90 of file elementview.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

◆ start_top_left_corner_

QPointF ElementView::start_top_left_corner_
private

Definition at line 89 of file elementview.h.

Referenced by pasteWithOffset().

◆ to_paste_in_area_

QString ElementView::to_paste_in_area_
private

Definition at line 87 of file elementview.h.

Referenced by paste(), pasteAreaDefined(), and pasteInArea().


The documentation for this class was generated from the following files: