Skip to content

Commit

Permalink
demo: Add "Is Movable" checkbox to operation/node context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Tectu committed Aug 23, 2023
1 parent fd5decb commit 08f6ff9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions demo/items/operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ void Operation::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
scene()->undoStack()->push(new QSchematic::Commands::LabelRename(label().get(), newText));
});

QAction* isMovable = new QAction;
isMovable->setCheckable(true);
isMovable->setChecked(this->isMovable());
isMovable->setText("Is Movable");
connect(isMovable, &QAction::toggled, [this](bool enabled) {
setMovable(enabled);
});

// Label visibility
QAction* labelVisibility = new QAction;
labelVisibility->setCheckable(true);
Expand Down Expand Up @@ -304,6 +312,8 @@ void Operation::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
menu.addSeparator();
menu.addAction(duplicate);
menu.addAction(deleteFromModel);
menu.addSeparator();
menu.addAction(isMovable);
}

// Sow the menu
Expand Down

0 comments on commit 08f6ff9

Please sign in to comment.