wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
ElementContextMenu Namespace Reference

Builds and executes the right-click context menu for circuit element selections. More...

Functions

void exec (QPoint screenPos, QGraphicsItem *itemAtMouse, const SelectionCapabilities &caps, const QList< GraphicElement * > &elements, QComboBox *colorCombo, Scene *scene, const std::function< void(QUndoCommand *)> &sendCommand, const std::function< void()> &onRename, const std::function< void()> &onTriggerChange, const std::function< void()> &onAppearanceChange, const std::function< void()> &onAppearanceRevert, const std::function< void()> &onFrequencyFocus, const std::function< void()> &onEditSubcircuit={}, const std::function< void()> &onEmbedSubcircuit={}, const std::function< void()> &onExtractToFile={})
 Builds and runs the right-click context menu for a set of selected elements.

Detailed Description

Builds and executes the right-click context menu for circuit element selections.

Separated from ElementEditor so the menu-building logic can be understood and tested independently of the property-editing panel.

Function Documentation

◆ exec()

void ElementContextMenu::exec ( QPoint screenPos,
QGraphicsItem * itemAtMouse,
const SelectionCapabilities & caps,
const QList< GraphicElement * > & elements,
QComboBox * colorCombo,
Scene * scene,
const std::function< void(QUndoCommand *)> & sendCommand,
const std::function< void()> & onRename,
const std::function< void()> & onTriggerChange,
const std::function< void()> & onAppearanceChange,
const std::function< void()> & onAppearanceRevert,
const std::function< void()> & onFrequencyFocus,
const std::function< void()> & onEditSubcircuit = {},
const std::function< void()> & onEmbedSubcircuit = {},
const std::function< void()> & onExtractToFile = {} )

Builds and runs the right-click context menu for a set of selected elements.

Parameters
screenPosScreen position where the menu should appear.
itemAtMouseItem under the mouse cursor (may be nullptr).
capsPre-computed selection capabilities.
elementsCurrently selected elements.
colorComboThe ElementEditor's color combo box (used to populate the Colors submenu).
sceneThe circuit scene (for Copy / Cut / Delete actions).
sendCommandCallback that pushes a command onto the undo stack.
onRenameCallback for the Rename action (focuses the label field).
onTriggerChangeCallback for the Change Trigger action (focuses the trigger field).
onAppearanceChangeCallback for the Change Appearance action (opens a file dialog).
onAppearanceRevertCallback for the Set Appearance to Default action.
onFrequencyFocusCallback for the Change Frequency action (focuses the spinbox).
onEditSubcircuitCallback for the Edit Subcircuit action (opens the IC editor).
onEmbedSubcircuitCallback for the Embed Subcircuit action (inlines the IC into the parent circuit).
onExtractToFileCallback for the Extract to File action (saves the IC definition to disk).

Definition at line 30 of file ElementContextMenu.cpp.

References addElementAction(), SelectionCapabilities::canChangeAppearance, SelectionCapabilities::canMorph, Scene::copyAction(), Scene::cutAction(), Scene::deleteAction(), SelectionCapabilities::hasColors, SelectionCapabilities::hasElements, SelectionCapabilities::hasFrequency, SelectionCapabilities::hasLabel, SelectionCapabilities::hasSameType, SelectionCapabilities::hasTrigger, SelectionCapabilities::isEmbedded, SelectionCapabilities::isFileBacked, PANDACEPTION_WITH_CONTEXT, and ElementFactory::pixmap().

Referenced by ElementEditor::contextMenu().