MCPcopy Create free account
hub / github.com/LibrePCB/LibrePCB / execRenameSheetDialog

Method execRenameSheetDialog

libs/librepcb/editor/project/projecteditor.cpp:599–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597}
598
599void ProjectEditor::execRenameSheetDialog(int index) noexcept {
600 Schematic* schematic = mProject->getSchematicByIndex(index);
601 if (!schematic) return;
602
603 bool ok = false;
604 const QString name = QInputDialog::getText(
605 qApp->activeWindow(), tr("Rename sheet"), tr("Choose new name:"),
606 QLineEdit::Normal, *schematic->getName(), &ok);
607 if (!ok) return;
608
609 emit abortBlockingToolsInOtherEditors(nullptr); // Release undo stack.
610
611 try {
612 std::unique_ptr<CmdSchematicEdit> cmd =
613 std::make_unique<CmdSchematicEdit>(*schematic);
614 cmd->setName(ElementName(cleanElementName(name))); // can throw
615 mUndoStack->execCmd(cmd.release());
616 } catch (const Exception& e) {
617 QMessageBox::critical(qApp->activeWindow(), tr("Error"), e.getMsg());
618 }
619}
620
621void ProjectEditor::execDeleteSheetDialog(int index) noexcept {
622 Schematic* schematic = mProject->getSchematicByIndex(index);

Callers 1

triggerSchematicMethod · 0.80

Calls 5

cleanElementNameFunction · 0.85
getSchematicByIndexMethod · 0.80
getNameMethod · 0.45
setNameMethod · 0.45
execCmdMethod · 0.45

Tested by

no test coverage detected