QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
DiagramEventAddImage Class Reference

The DiagramEventAddImage class This diagram event, handle the adding of an image in a diagram. More...

#include <diagrameventaddimage.h>

Inheritance diagram for DiagramEventAddImage:
Inheritance graph
Collaboration diagram for DiagramEventAddImage:
Collaboration graph

Public Member Functions

 DiagramEventAddImage (Diagram *diagram)
 DiagramEventAddImage::DiagramEventAddImage Default constructor.
 ~DiagramEventAddImage () override
 DiagramEventAddImage::~DiagramEventAddImage.
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 DiagramEventAddImage::mousePressEvent Left button: starts a potential drag-to-resize, anchored here – but doesn't commit to anything yet. A quick click-release (see mouseMoveEvent's threshold check) still places the image at its original size, matching the previous behavior exactly; only an actual drag switches to resizing. Right button still rotates in 90 degree steps, unchanged, and only while not already left-dragging.
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 DiagramEventAddImage::mouseMoveEvent Action when mouse move.
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 DiagramEventAddImage::mouseReleaseEvent Left button release commits whatever mouseMoveEvent last set – original size and centered if the press never turned into a real drag, or the dragged-out size and position otherwise. Either way, this is the only place placement is actually finalized now; a plain click no longer finishes inside mousePressEvent itself, since it has to wait and see whether a drag follows.
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
 DiagramEventAddImage::mouseDoubleClickEvent This method is used only to overwrite double click. When double click, image properties dialog isn't open.
void wheelEvent (QGraphicsSceneWheelEvent *event) override
 DiagramEventAddImage::wheelEvent Action when mouse wheel is rotated.
bool isNull () const
 DiagramEventAddImage::isNull.
Public Member Functions inherited from DiagramEventInterface
 DiagramEventInterface (Diagram *diagram)
 ~DiagramEventInterface () override=0
virtual void keyPressEvent (QKeyEvent *event)
 DiagramEventInterface::keyPressEvent By default, press escape key abort the current action.
virtual void keyReleaseEvent (QKeyEvent *event)
virtual bool isRunning () const
virtual void init ()

Private Member Functions

void openDialog ()
 DiagramEventAddImage::openDialog Open dialog to select the image to add.
void showHint () const
 DiagramEventAddImage::showHint Re-asserted on every move (see mouseMoveEvent), not just once at activation: Qt's own built-in "show an action's statusTip on hover" has its own internal "restore whatever was there before" logic for when the hover ends. Since this message is first shown during that same hover session (the user is still over the toolbar icon when the deferred constructor-time call above fires), Qt's hover-tracking has no idea this code changed the status bar in the meantime – the moment the mouse leaves the icon for the canvas, it silently restores whatever it remembers being there before its own tip started, overwriting this one. Re-showing it on every move within the canvas simply outlasts that one-time restore – the exact same issue already found and fixed for the shape tools.

Private Attributes

DiagramImageItemm_image
bool m_is_added
bool m_pressed = false
bool m_resize_engaged = false
QPointF m_press_pos

Additional Inherited Members

Signals inherited from DiagramEventInterface
void finish ()
Protected Attributes inherited from DiagramEventInterface
QPointer< Diagramm_diagram
bool m_running {false}
bool m_abort {false}

Detailed Description

The DiagramEventAddImage class This diagram event, handle the adding of an image in a diagram.

Constructor & Destructor Documentation

◆ DiagramEventAddImage()

DiagramEventAddImage::DiagramEventAddImage ( Diagram * diagram)

DiagramEventAddImage::DiagramEventAddImage Default constructor.

Parameters
diagram: diagram where operate this event
Here is the call graph for this function:

◆ ~DiagramEventAddImage()

DiagramEventAddImage::~DiagramEventAddImage ( )
override

DiagramEventAddImage::~DiagramEventAddImage.

Here is the call graph for this function:

Member Function Documentation

◆ isNull()

bool DiagramEventAddImage::isNull ( ) const

DiagramEventAddImage::isNull.

Returns
: true if image can't be loaded, otherwise return false.
Here is the caller graph for this function:

◆ mouseDoubleClickEvent()

void DiagramEventAddImage::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event)
overridevirtual

DiagramEventAddImage::mouseDoubleClickEvent This method is used only to overwrite double click. When double click, image properties dialog isn't open.

Parameters
event: event of mouse double click.

Reimplemented from DiagramEventInterface.

◆ mouseMoveEvent()

void DiagramEventAddImage::mouseMoveEvent ( QGraphicsSceneMouseEvent * event)
overridevirtual

DiagramEventAddImage::mouseMoveEvent Action when mouse move.

Parameters
event: event of mouse move

Reimplemented from DiagramEventInterface.

Here is the call graph for this function:

◆ mousePressEvent()

void DiagramEventAddImage::mousePressEvent ( QGraphicsSceneMouseEvent * event)
overridevirtual

DiagramEventAddImage::mousePressEvent Left button: starts a potential drag-to-resize, anchored here – but doesn't commit to anything yet. A quick click-release (see mouseMoveEvent's threshold check) still places the image at its original size, matching the previous behavior exactly; only an actual drag switches to resizing. Right button still rotates in 90 degree steps, unchanged, and only while not already left-dragging.

Parameters
event: event of mouse pressed

Reimplemented from DiagramEventInterface.

◆ mouseReleaseEvent()

void DiagramEventAddImage::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event)
overridevirtual

DiagramEventAddImage::mouseReleaseEvent Left button release commits whatever mouseMoveEvent last set – original size and centered if the press never turned into a real drag, or the dragged-out size and position otherwise. Either way, this is the only place placement is actually finalized now; a plain click no longer finishes inside mousePressEvent itself, since it has to wait and see whether a drag follows.

Parameters
event: event of mouse release

Reimplemented from DiagramEventInterface.

Here is the call graph for this function:

◆ openDialog()

void DiagramEventAddImage::openDialog ( )
private

DiagramEventAddImage::openDialog Open dialog to select the image to add.

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

◆ showHint()

void DiagramEventAddImage::showHint ( ) const
private

DiagramEventAddImage::showHint Re-asserted on every move (see mouseMoveEvent), not just once at activation: Qt's own built-in "show an action's statusTip on hover" has its own internal "restore whatever was there before" logic for when the hover ends. Since this message is first shown during that same hover session (the user is still over the toolbar icon when the deferred constructor-time call above fires), Qt's hover-tracking has no idea this code changed the status bar in the meantime – the moment the mouse leaves the icon for the canvas, it silently restores whatever it remembers being there before its own tip started, overwriting this one. Re-showing it on every move within the canvas simply outlasts that one-time restore – the exact same issue already found and fixed for the shape tools.

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

◆ wheelEvent()

void DiagramEventAddImage::wheelEvent ( QGraphicsSceneWheelEvent * event)
overridevirtual

DiagramEventAddImage::wheelEvent Action when mouse wheel is rotated.

Parameters
eventevet of mouse wheel

Reimplemented from DiagramEventInterface.

Member Data Documentation

◆ m_image

DiagramImageItem* DiagramEventAddImage::m_image
private

◆ m_is_added

bool DiagramEventAddImage::m_is_added
private

◆ m_press_pos

QPointF DiagramEventAddImage::m_press_pos
private

◆ m_pressed

bool DiagramEventAddImage::m_pressed = false
private

◆ m_resize_engaged

bool DiagramEventAddImage::m_resize_engaged = false
private

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