QElectroTech
0.8-dev
|
The ElementScene class This class is the canvas allowing the visual edition of an electrial element. It displays the various primitives composing the drawing of the element, the border due to its fixed size and its hotspot. More...
#include <elementscene.h>
Inherits QGraphicsScene.
Public Types | |
enum | Behavior { Normal, PasteArea, AddPart } |
enum | ItemOption { SortByZValue = 1, IncludeTerminals = 2, IncludeHelperItems = 4, Selected = 8, NonSelected = 16, SelectedOrNot = 24 } |
Public Slots | |
void | slot_select (const ElementContent &) |
ElementScene::slot_select Select the item in content, every others items in the scene are deselected. More... | |
void | slot_selectAll () |
ElementScene::slot_selectAll Select all items. More... | |
void | slot_deselectAll () |
ElementScene::slot_deselectAll deselect all item. More... | |
void | slot_invertSelection () |
ElementScene::slot_invertSelection Inverse Selection. More... | |
void | slot_delete () |
ElementScene::slot_delete Delete selected items. More... | |
void | slot_editNames () |
ElementScene::slot_editNames Launch a dialog for edit the names of the edited element. More... | |
void | slot_editAuthorInformations () |
ElementScene::slot_editAuthorInformations Starts a dialog to edit the additional information of this element. Concretely, this free field is intended to receive information on the author of the element, its license, etc. More... | |
void | slot_editProperties () |
ElementScene::slot_editProperties Open dialog to edit the element properties. More... | |
void | managePrimitivesGroups () |
ElementScene::managePrimitivesGroups Ensure the decorator is adequately shown, hidden or updated so it always represents the current selection. More... | |
void | stackAction (ElementEditionCommand *) |
ElementScene::stackAction Push the provided command on the undo stack. More... | |
Signals | |
void | partsAdded () |
Signal emitted after one or several parts were added. More... | |
void | partsRemoved () |
Signal emitted after one or several parts were removed. More... | |
void | partsZValueChanged () |
Signal emitted when the zValue of one or several parts change. More... | |
void | pasteAreaDefined (const QRectF &) |
Signal emitted when users have defined the copy/paste area. More... | |
void | needZoomFit () |
Signal emitted when need zoomFit. More... | |
void | elementInfoChanged () |
Public Member Functions | |
ElementScene (QETElementEditor *, QObject *=nullptr) | |
ElementScene::ElementScene constructor. More... | |
~ElementScene () override | |
ElementScene::~ElementScene. More... | |
void | setEventInterface (ESEventInterface *event_interface) |
ElementScene::setEventInterface Set a new event interface. More... | |
void | clearEventInterface () |
ElementScene::clearEventInterface Clear the current event interface. More... | |
void | setBehavior (ElementScene::Behavior) |
ElementScene::setBehavior Modify the current behavior of this scene. More... | |
ElementScene::Behavior | behavior () const |
QPointF | snapToGrid (QPointF point) |
ElementScene::snapToGrid Rounds the coordinates of the point passed as a parameter so that this point is aligned with the grid. More... | |
void | setNames (const NamesList &) |
ElementScene::setNames. More... | |
NamesList | names () const |
ElementScene::names. More... | |
QString | informations () const |
ElementScene::informations. More... | |
void | setInformations (const QString &) |
ElementScene::setInformations. More... | |
QString | elementType () const |
DiagramContext | elementKindInfo () const |
DiagramContext | elementInformation () const |
virtual int | xGrid () const |
ElementScene::xGrid. More... | |
virtual int | yGrid () const |
ElementScene::yGrid. More... | |
virtual void | setGrid (int, int) |
ElementScene::setGrid. More... | |
virtual const QDomDocument | toXml (bool=true) |
ElementScene::toXml Export this element as a xml file. More... | |
virtual QRectF | boundingRectFromXml (const QDomDocument &) |
ElementScene::boundingRectFromXml. More... | |
virtual void | fromXml (const QDomDocument &, const QPointF &=QPointF(), bool=true, ElementContent *=nullptr) |
ElementScene::fromXml Imports the element described in an XML document. If a position is specified, the imported elements are positioned in such a way that the upper left corner of the smallest rectangle that can surround them all (the bounding rect) either at this position. More... | |
virtual void | reset () |
ElementScene::reset Remove all QGraphicsItems in the scene and clear the undo stack. More... | |
virtual QList< CustomElementPart * > | primitives () const |
ElementScene::primitives. More... | |
virtual QList< QGraphicsItem * > | zItems (ItemOptions options=ItemOptions(SortByZValue|IncludeTerminals|SelectedOrNot)) const |
ElementScene::zItems. More... | |
virtual ElementContent | selectedContent () const |
ElementScene::selectedContent. More... | |
virtual void | getPasteArea (const QRectF &) |
ElementScene::getPasteArea. More... | |
QRectF | elementSceneGeometricRect () const |
ElementScene::elementSceneGeometricRect. More... | |
bool | containsTerminals () const |
ElementScene::containsTerminals. More... | |
QUndoStack & | undoStack () |
ElementScene::undoStack. More... | |
QGIManager & | qgiManager () |
ElementScene::qgiManager. More... | |
bool | wasCopiedFromThisElement (const QString &) |
ElementScene::wasCopiedFromThisElement. More... | |
void | cut () |
ElementScene::cut Handles the fact of cutting the selection = exporting it in XML to the clipboard then deleting it. More... | |
void | copy () |
ElementScene::copy Handles the fact of copying the selection = exporting it as XML to the clipboard. More... | |
QETElementEditor * | editor () const |
ElementScene::editor. More... | |
void | setElementInfo (const DiagramContext &dc) |
ElementScene::setElementInfo. More... | |
Static Public Member Functions | |
static bool | clipboardMayContainElement () |
ElementScene::clipboardMayContainElement. More... | |
Protected Member Functions | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *) override |
ElementScene::mouseMoveEvent. More... | |
void | mousePressEvent (QGraphicsSceneMouseEvent *) override |
ElementScene::mousePressEvent. More... | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *) override |
ElementScene::mouseReleaseEvent. More... | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
ElementScene::mouseDoubleClickEvent. More... | |
void | keyPressEvent (QKeyEvent *event) override |
ElementScene::keyPressEvent manage key press event. More... | |
void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) override |
ElementScene::contextMenuEvent Display the context menu event, only if behavior are Normal. More... | |
void | drawForeground (QPainter *, const QRectF &) override |
ElementScene::drawForeground Draws the background of the editor, ie the hotspot indicator. More... | |
Private Member Functions | |
ElementScene (const ElementScene &) | |
QRectF | elementContentBoundingRect (const ElementContent &) const |
ElementScene::elementContentBoundingRect. More... | |
bool | applyInformations (const QDomDocument &) |
ElementScene::applyInformations Applies the information (dimensions, hostpot, orientations, internal connections, names and additional information) contained in an XML document. More... | |
ElementContent | loadContent (const QDomDocument &) |
ElementScene::loadContent Create and load the content describe in the xml document. More... | |
ElementContent | addContent (const ElementContent &) |
ElementScene::addContent Add content content to this element. More... | |
ElementContent | addContentAtPos (const ElementContent &, const QPointF &) |
ElementScene::addContentAtPos Add content content to this element. More... | |
void | addPrimitive (QGraphicsItem *) |
ElementScene::addPrimitive Add a primitive to the scene by wrapping it within an ElementPrimitiveDecorator group. More... | |
void | initPasteArea () |
ElementScene::initPasteArea Initializes the paste area. More... | |
void | centerElementToOrigine () |
ElementScene::centerElementToOrigine try to center better is possible the element to the scene (the calcul isn't optimal but work good) More... | |
Static Private Member Functions | |
static bool | zValueLessThan (QGraphicsItem *, QGraphicsItem *) |
ElementScene::zValueLessThan. More... | |
Private Attributes | |
NamesList | m_names_list |
QString | m_informations |
List of localized names. More... | |
QString | m_elmt_type |
Extra informations. More... | |
DiagramContext | m_elmt_kindInfo |
element type More... | |
DiagramContext | m_elmt_information |
QGIManager | m_qgi_manager |
element kind info More... | |
QUndoStack | m_undo_stack |
ESEventInterface * | m_event_interface = nullptr |
Behavior | m_behavior |
QETElementEditor * | m_element_editor = nullptr |
QGraphicsRectItem * | m_paste_area |
QRectF | m_defined_paste_area |
QString | m_last_copied |
ElementPrimitiveDecorator * | m_decorator = nullptr |
Decorator item displayed when at least one item is selected. More... | |
int | m_x_grid |
int | m_y_grid |
QMutex * | m_decorator_lock |
Friends | |
class | ChangePropertiesCommand |
The ElementScene class This class is the canvas allowing the visual edition of an electrial element. It displays the various primitives composing the drawing of the element, the border due to its fixed size and its hotspot.
ElementScene::ElementScene | ( | QETElementEditor * | editor, |
QObject * | parent = nullptr |
||
) |
ElementScene::ElementScene constructor.
editor | : Element editor concerned |
parent | : Widget parent |
|
override |
|
private |
|
private |
ElementScene::addContent Add content content to this element.
content | : content (= list of parts) to load |
|
private |
ElementScene::addContentAtPos Add content content to this element.
content | : content (= list of parts) to load |
pos | : Position of the upper left corner of the content after being added |
|
private |
ElementScene::addPrimitive Add a primitive to the scene by wrapping it within an ElementPrimitiveDecorator group.
primitive |
|
private |
ElementScene::applyInformations Applies the information (dimensions, hostpot, orientations, internal connections, names and additional information) contained in an XML document.
xml_document | : Document XML a analyser |
ElementScene::Behavior ElementScene::behavior | ( | ) | const |
|
virtual |
ElementScene::boundingRectFromXml.
xml_document | : an XML document describing an element |
|
private |
ElementScene::centerElementToOrigine try to center better is possible the element to the scene (the calcul isn't optimal but work good)
void ElementScene::clearEventInterface | ( | ) |
ElementScene::clearEventInterface Clear the current event interface.
|
static |
ElementScene::clipboardMayContainElement.
bool ElementScene::containsTerminals | ( | ) | const |
ElementScene::containsTerminals.
|
overrideprotected |
ElementScene::contextMenuEvent Display the context menu event, only if behavior are Normal.
event |
void ElementScene::copy | ( | ) |
ElementScene::copy Handles the fact of copying the selection = exporting it as XML to the clipboard.
void ElementScene::cut | ( | ) |
ElementScene::cut Handles the fact of cutting the selection = exporting it in XML to the clipboard then deleting it.
|
overrideprotected |
ElementScene::drawForeground Draws the background of the editor, ie the hotspot indicator.
p | : The QPainter to use for drawing |
rect | : The rectangle of the area to be drawn |
QETElementEditor * ElementScene::editor | ( | ) | const |
|
private |
ElementScene::elementContentBoundingRect.
content | : Content (= parts) of an element |
|
signal |
|
inline |
|
inline |
QRectF ElementScene::elementSceneGeometricRect | ( | ) | const |
ElementScene::elementSceneGeometricRect.
|
inline |
|
virtual |
ElementScene::fromXml Imports the element described in an XML document. If a position is specified, the imported elements are positioned in such a way that the upper left corner of the smallest rectangle that can surround them all (the bounding rect) either at this position.
xml_document | : an XML document describing the element |
position | : The position of the imported parts |
consider_informations | : If true, additional information (dimensions, hotspot, etc.) will be taken into account |
content_ptr | : if this pointer to an ElementContent is different from 0, it will be filled with the content added to the element by the fromXml |
|
virtual |
to_paste | : Rectangle enclosing the parts to be glued |
|
inline |
|
private |
|
overrideprotected |
ElementScene::keyPressEvent manage key press event.
event |
|
private |
ElementScene::loadContent Create and load the content describe in the xml document.
xml_document | : xml dom document to analyze |
|
slot |
ElementScene::managePrimitivesGroups Ensure the decorator is adequately shown, hidden or updated so it always represents the current selection.
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
inline |
|
signal |
Signal emitted when need zoomFit.
|
signal |
Signal emitted after one or several parts were added.
|
signal |
Signal emitted after one or several parts were removed.
|
signal |
Signal emitted when the zValue of one or several parts change.
|
signal |
Signal emitted when users have defined the copy/paste area.
|
virtual |
QGIManager & ElementScene::qgiManager | ( | ) |
|
virtual |
ElementScene::reset Remove all QGraphicsItems in the scene and clear the undo stack.
|
virtual |
ElementScene::selectedContent.
void ElementScene::setBehavior | ( | ElementScene::Behavior | b | ) |
ElementScene::setBehavior Modify the current behavior of this scene.
b |
void ElementScene::setElementInfo | ( | const DiagramContext & | dc | ) |
void ElementScene::setEventInterface | ( | ESEventInterface * | event_interface | ) |
ElementScene::setEventInterface Set a new event interface.
event_interface |
|
virtual |
x_g | : Horizontal grid size |
y_g | : Vertical grid size |
|
inline |
ElementScene::setInformations.
infos | new extra information for the currently edited element |
|
inline |
nameslist | New set of naes for the currently edited element |
|
slot |
ElementScene::slot_delete Delete selected items.
|
slot |
|
slot |
ElementScene::slot_editAuthorInformations Starts a dialog to edit the additional information of this element. Concretely, this free field is intended to receive information on the author of the element, its license, etc.
|
slot |
ElementScene::slot_editNames Launch a dialog for edit the names of the edited element.
|
slot |
ElementScene::slot_editProperties Open dialog to edit the element properties.
|
slot |
ElementScene::slot_invertSelection Inverse Selection.
|
slot |
ElementScene::slot_select Select the item in content, every others items in the scene are deselected.
content |
|
slot |
QPointF ElementScene::snapToGrid | ( | QPointF | point | ) |
ElementScene::snapToGrid Rounds the coordinates of the point passed as a parameter so that this point is aligned with the grid.
point | : a reference to a QPointF. This object will be modified. |
|
slot |
ElementScene::stackAction Push the provided command on the undo stack.
command |
|
virtual |
ElementScene::toXml Export this element as a xml file.
all_parts | : (true by default) if true, export the entire element in xml, if false, only export the selected parts. |
QUndoStack & ElementScene::undoStack | ( | ) |
bool ElementScene::wasCopiedFromThisElement | ( | const QString & | clipboard_content | ) |
ElementScene::wasCopiedFromThisElement.
clipboard_content | : character string, probably coming from the clipboard. |
|
virtual |
|
virtual |
|
virtual |
options |
|
staticprivate |
item1 | : QGraphicsItem |
item2 | : QGraphicsItem |
|
friend |
|
private |
|
private |
Decorator item displayed when at least one item is selected.
|
private |
|
private |
|
private |
|
private |
|
private |
element type
|
private |
Extra informations.
|
private |
|
private |
List of localized names.
|
private |
|
private |
|
private |
|
private |
element kind info
|
private |
|
private |
|
private |