wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
InlineLabelEditor Class Reference

Hosts a temporary QLineEdit directly on the canvas to rename an element's label in place, in response to GraphicElement::inlineEditRequested(). More...

#include <InlineLabelEditor.h>

Public Member Functions

void cancel ()
 Discards the current edit (if any) and closes the editor without changing anything.
void commit ()
 InlineLabelEditor (Scene *scene)
void start (GraphicElement *element)
 Starts inline-editing element's label, committing any already-in-progress edit first.
 ~InlineLabelEditor ()

Detailed Description

Hosts a temporary QLineEdit directly on the canvas to rename an element's label in place, in response to GraphicElement::inlineEditRequested().

Follows the SceneDropHandler/ConnectionManager pattern: holds a back-reference to the owning Scene and delegates the undo command back to it. Only one inline edit is ever active at a time; starting a new one commits whatever was already in progress.

Definition at line 23 of file InlineLabelEditor.h.

Constructor & Destructor Documentation

◆ InlineLabelEditor()

InlineLabelEditor::InlineLabelEditor ( Scene * scene)
explicit

Definition at line 47 of file InlineLabelEditor.cpp.

◆ ~InlineLabelEditor()

InlineLabelEditor::~InlineLabelEditor ( )
default

Member Function Documentation

◆ cancel()

void InlineLabelEditor::cancel ( )

Discards the current edit (if any) and closes the editor without changing anything.

Definition at line 113 of file InlineLabelEditor.cpp.

◆ commit()

void InlineLabelEditor::commit ( )

Commits the current edit (if any): pushes an UpdateCommand only if the text actually changed, then closes the editor. Safe to call when nothing is being edited (no-op).

Definition at line 91 of file InlineLabelEditor.cpp.

References InMemorySnapshot, and Serialization::writePandaHeader().

Referenced by start().

◆ start()

void InlineLabelEditor::start ( GraphicElement * element)

Starts inline-editing element's label, committing any already-in-progress edit first.

Definition at line 54 of file InlineLabelEditor.cpp.

References commit(), GraphicElement::label(), and GraphicElement::labelSceneBoundingRect().


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