QElectroTech  0.8-dev
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>

Inherits QGraphicsView.

Collaboration diagram for ElementView:
Collaboration graph

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 &)
 ElementView::applyMovement Applique le decalage offset dans le sens movement au rectangle start. More...
 
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.

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
Here is the call graph for this function:

◆ ~ElementView()

ElementView::~ElementView ( )
override

Destructeur.

◆ 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.

Here is the caller graph for this function:

◆ applyMovement()

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

ElementView::applyMovement Applique le decalage offset dans le sens movement au rectangle start.

Parameters
start: rectangle a decaler
offset: Decalage a appliquer
Returns
Here is the caller graph for this function:

◆ copy

void ElementView::copy ( )
slot

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

◆ cut

void ElementView::cut ( )
slot

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

◆ 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
Here is the call graph for this function:

◆ event()

bool ElementView::event ( QEvent *  e)
overrideprotected

Gere les evenements de la ElementView

Parameters
eEvenement
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gestureEvent()

bool ElementView::gestureEvent ( QGestureEvent *  event)
protected

ElementView::gestureEvent.

Utilise le pincement du trackpad pour zoomer

Parameters
event
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gestures()

bool ElementView::gestures ( ) const
private

ElementView::gestures.

Returns
Here is the caller graph for this function:

◆ getPasteArea

void ElementView::getPasteArea ( const QRectF &  to_paste)
privateslot
Parameters
to_pasteRectangle englobant les parties a coller
Here is the caller graph for this function:

◆ modeChanged

void ElementView::modeChanged ( )
signal

Signal emitted after the mode changed.

Here is the caller graph for this function:

◆ mouseMoveEvent()

void ElementView::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

ElementView::mouseMoveEvent Manage the event move mouse.

◆ 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

◆ mouseReleaseEvent()

void ElementView::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

ElementView::mouseReleaseEvent Manage event release click mouse.

Here is the call graph for this function:

◆ 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 &)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ paste [2/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

◆ paste [3/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
Here is the call graph for this function:

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pasteInArea

void ElementView::pasteInArea ( )
slot

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

Here is the call graph for this function:

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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é.

Here is the caller graph for this function:

◆ scene()

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

◆ setScene()

void ElementView::setScene ( ElementScene s)

Definit l'ElementScene visualisee par cette ElementView

Parameters
sl'ElementScene visualisee par cette ElementView

◆ setSelectionMode

void ElementView::setSelectionMode ( )
slot

Set the Diagram in Selection mode

◆ setVisualisationMode

void ElementView::setVisualisationMode ( )
slot

Set the Diagram in visualisation mode

◆ viewedSceneRect()

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

◆ wheelEvent()

void ElementView::wheelEvent ( QWheelEvent *  e)
overrideprotected

ElementView::wheelEvent.

Parameters
e
Here is the call graph for this function:

◆ 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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zoomIn

void ElementView::zoomIn ( )
slot

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zoomInSlowly

void ElementView::zoomInSlowly ( )
slot

Agrandit le schema avec le trackpad

Here is the caller graph for this function:

◆ zoomOut

void ElementView::zoomOut ( )
slot

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zoomOutSlowly

void ElementView::zoomOutSlowly ( )
slot

Retrecit le schema avec le trackpad

Here is the caller graph for this function:

◆ zoomReset

void ElementView::zoomReset ( )
slot

Reinitialise le zoom

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ PastePartsCommand

friend class PastePartsCommand
friend

Member Data Documentation

◆ m_scene

ElementScene* ElementView::m_scene
private

◆ offset_paste_count_

int ElementView::offset_paste_count_
private

◆ reference_view_

QPointF ElementView::reference_view_
private

◆ start_top_left_corner_

QPointF ElementView::start_top_left_corner_
private

◆ to_paste_in_area_

QString ElementView::to_paste_in_area_
private

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