|
wiRedPanda
Logic Circuit Simulator
|
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. | |
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.
| 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.
| screenPos | Screen position where the menu should appear. |
| itemAtMouse | Item under the mouse cursor (may be nullptr). |
| caps | Pre-computed selection capabilities. |
| elements | Currently selected elements. |
| colorCombo | The ElementEditor's color combo box (used to populate the Colors submenu). |
| scene | The circuit scene (for Copy / Cut / Delete actions). |
| sendCommand | Callback that pushes a command onto the undo stack. |
| onRename | Callback for the Rename action (focuses the label field). |
| onTriggerChange | Callback for the Change Trigger action (focuses the trigger field). |
| onAppearanceChange | Callback for the Change Appearance action (opens a file dialog). |
| onAppearanceRevert | Callback for the Set Appearance to Default action. |
| onFrequencyFocus | Callback for the Change Frequency action (focuses the spinbox). |
| onEditSubcircuit | Callback for the Edit Subcircuit action (opens the IC editor). |
| onEmbedSubcircuit | Callback for the Embed Subcircuit action (inlines the IC into the parent circuit). |
| onExtractToFile | Callback 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().