From 8e648f7332a61c4a3538b6d94b3fc8a906f6c70d Mon Sep 17 00:00:00 2001 From: ispyisail Date: Mon, 5 Oct 2026 22:54:49 +1300 Subject: [PATCH] Add the missing folio editor commands to the Shortcuts page 44 commands in the folio editor's menus and toolbars had no ShortcutManager id, so they could not be given a key, found by the command search or put on the shortcut bar: Export to PDF, the grid and guide toggles, Selection/View mode, most of the Project menu, Tile and Cascade, the Help menu items, and others. Register each with no default key, as the add-item tools already are. What's This keeps the Shift+F1 that Qt gives it. No other command had a key before, so nothing changes for anyone who has not set one. Left out: the option lists inside submenus (text grid step, the Show menu's item kinds, background colours). They are choices, not commands. First stage of discussion #1319. Co-Authored-By: Claude Opus 5.5 --- sources/qetdiagrameditor.cpp | 37 ++++++++++++++++++++++++++++++++++++ sources/qetmainwindow.cpp | 10 ++++++++++ 2 files changed, 47 insertions(+) diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index c7faddfa6..bf6b01396 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -364,6 +364,7 @@ void QETDiagramEditor::setUpActions() //export to pdf m_export_to_pdf = new QAction(QET::Icons::PDF, tr("Exporter en pdf"), this); + ShortcutManager::instance().registerAction(m_export_to_pdf, "diagrameditor.export_to_pdf", tr("Éditeur de schémas"), QKeySequence()); m_export_to_pdf->setStatusTip(tr("Exporte un ou plusieurs folios du projet courant", "status bar tip")); connect(m_export_to_pdf, &QAction::triggered, [this] () { auto project = currentProject(); @@ -480,6 +481,7 @@ void QETDiagramEditor::setUpActions() //setting, so it does not need a diagram open or anything //selected the way m_duplicate itself does. m_configure_duplicate = new QAction(tr("Configurer la duplication..."), this); + ShortcutManager::instance().registerAction(m_configure_duplicate, "diagrameditor.configure_duplicate", tr("Éditeur de schémas"), QKeySequence()); m_configure_duplicate->setStatusTip(tr("Choisir l'espacement et la direction utilisés par Dupliquer", "status bar tip")); connect(m_configure_duplicate, &QAction::triggered, [this]() { DuplicateOffsetDialog dialog(this); @@ -515,6 +517,7 @@ void QETDiagramEditor::setUpActions() //AutoBreakConductor m_auto_break_conductor = new QAction (QET::Icons::Conductor, tr("Coupure automatique de conducteur(s)","Tool tip of auto break conductor"), this); + ShortcutManager::instance().registerAction(m_auto_break_conductor, "diagrameditor.auto_break_conductor", tr("Éditeur de schémas"), QKeySequence()); m_auto_break_conductor->setStatusTip (tr("Couper automatiquement les conducteurs existants lors du placement d'un élément", "Status tip of auto break conductor")); m_auto_break_conductor->setCheckable (true); { @@ -533,6 +536,7 @@ void QETDiagramEditor::setUpActions() //Draw or not the background grid m_draw_grid = new QAction ( QET::Icons::Grid, tr("Afficher la grille"), this); + ShortcutManager::instance().registerAction(m_draw_grid, "diagrameditor.draw_grid", tr("Éditeur de schémas"), QKeySequence()); m_draw_grid->setStatusTip(tr("Affiche ou masque la grille des folios")); QSettings settings; m_draw_grid->setCheckable(true); @@ -574,6 +578,7 @@ void QETDiagramEditor::setUpActions() // Draw or not the custom guides m_draw_guides = new QAction ( QIcon::fromTheme("guides"), tr("Afficher les guides"), this); + ShortcutManager::instance().registerAction(m_draw_guides, "diagrameditor.draw_guides", tr("Éditeur de schémas"), QKeySequence()); m_draw_guides->setStatusTip(tr("Affiche ou masque les guides")); m_draw_guides->setCheckable(true); m_draw_guides->setChecked(settings.value("diagrameditor/guides_display_startup", false).toBool()); @@ -586,6 +591,7 @@ void QETDiagramEditor::setUpActions() //Keep the column numbers and row letters of the folio in sight m_cell_rulers = new QAction(tr("Garder les en-têtes visibles"), this); + ShortcutManager::instance().registerAction(m_cell_rulers, "diagrameditor.cell_rulers", tr("Éditeur de schémas"), QKeySequence()); m_cell_rulers->setStatusTip(tr("Garde les numéros de colonne et les lettres de ligne du folio visibles au bord de la vue")); m_cell_rulers->setCheckable(true); m_cell_rulers->setChecked(settings.value("diagrameditor/cell_rulers", false).toBool()); @@ -598,6 +604,7 @@ void QETDiagramEditor::setUpActions() //Draw the limits of the folio columns and rows across the drawing m_cell_lines = new QAction(tr("Afficher les limites des cases"), this); + ShortcutManager::instance().registerAction(m_cell_lines, "diagrameditor.cell_lines", tr("Éditeur de schémas"), QKeySequence()); m_cell_lines->setStatusTip(tr("Trace les limites des colonnes et des lignes du folio sur le schéma, à l'écran seulement")); m_cell_lines->setCheckable(true); m_cell_lines->setChecked(settings.value("diagrameditor/cell_lines", false).toBool()); @@ -652,6 +659,7 @@ void QETDiagramEditor::setUpActions() //Edit current project properties m_project_edit_properties = new QAction(QET::Icons::ProjectProperties, tr("Propriétés du projet"), this); + ShortcutManager::instance().registerAction(m_project_edit_properties, "diagrameditor.project_edit_properties", tr("Éditeur de schémas"), QKeySequence()); connect(m_project_edit_properties, &QAction::triggered, [this]() { editProjectProperties(currentProjectView()); }); @@ -667,10 +675,12 @@ void QETDiagramEditor::setUpActions() //Remove current folio from current project m_remove_diagram_from_project = new QAction(QET::Icons::DiagramDelete, tr("Supprimer le folio"), this); + ShortcutManager::instance().registerAction(m_remove_diagram_from_project, "diagrameditor.remove_diagram_from_project", tr("Éditeur de schémas"), QKeySequence()); connect(m_remove_diagram_from_project, &QAction::triggered, this, &QETDiagramEditor::removeDiagramFromProject); //Clean the current project m_clean_project = new QAction(QET::Icons::EditClear, tr("Nettoyer le projet"), this); + ShortcutManager::instance().registerAction(m_clean_project, "diagrameditor.clean_project", tr("Éditeur de schémas"), QKeySequence()); connect(m_clean_project, &QAction::triggered, [this]() { if (ProjectView *current_project = currentProjectView()) { if (current_project->cleanProject()) { @@ -681,6 +691,7 @@ void QETDiagramEditor::setUpActions() //Export nomenclature to CSV m_csv_export = new QAction(QET::Icons::DocumentSpreadsheet, tr("Exporter au format CSV"), this); + ShortcutManager::instance().registerAction(m_csv_export, "diagrameditor.csv_export", tr("Éditeur de schémas"), QKeySequence()); connect(m_csv_export, &QAction::triggered, [this]() { BOMExportDialog bom(currentProjectView()->project(), this); bom.exec(); @@ -688,6 +699,7 @@ void QETDiagramEditor::setUpActions() //Add a nomenclature item m_add_nomenclature = new QAction(QET::Icons::TableOfContent, tr("Ajouter une nomenclature"), this); + ShortcutManager::instance().registerAction(m_add_nomenclature, "diagrameditor.add_nomenclature", tr("Éditeur de schémas"), QKeySequence()); connect(m_add_nomenclature, &QAction::triggered, this, [this]() { if(this->currentDiagramView()) { QetGraphicsTableFactory::createAndAddNomenclature(this->currentDiagramView()->diagram()); @@ -696,6 +708,7 @@ void QETDiagramEditor::setUpActions() //Add a summary item m_add_summary = new QAction(QET::Icons::TableOfContent, tr("Ajouter un sommaire"), this); + ShortcutManager::instance().registerAction(m_add_summary, "diagrameditor.add_summary", tr("Éditeur de schémas"), QKeySequence()); connect(m_add_summary, &QAction::triggered, this, [this]() { if(this->currentDiagramView()) { QetGraphicsTableFactory::createAndAddSummary(this->currentDiagramView()->diagram()); @@ -703,6 +716,7 @@ void QETDiagramEditor::setUpActions() }); m_terminal_strip_dialog = new QAction(QET::Icons::TerminalStrip, tr("Gestionnaire de borniers (DEV)"), this); + ShortcutManager::instance().registerAction(m_terminal_strip_dialog, "diagrameditor.terminal_strip_dialog", tr("Éditeur de schémas"), QKeySequence()); connect(m_terminal_strip_dialog, &QAction::triggered, this, [this]() { if (auto project = this->currentProject()) @@ -713,10 +727,12 @@ void QETDiagramEditor::setUpActions() //Launch the plugin of terminal generator m_project_terminalBloc = new QAction(QET::Icons::TerminalStrip, tr("Lancer le plugin de création de borniers"), this); + ShortcutManager::instance().registerAction(m_project_terminalBloc, "diagrameditor.terminal_strip_plugin", tr("Éditeur de schémas"), QKeySequence()); connect(m_project_terminalBloc, &QAction::triggered, this, &QETDiagramEditor::generateTerminalBlock); //Export conductor num to csv m_project_export_conductor_num = new QAction(QET::Icons::DocumentSpreadsheet, tr("Exporter la liste des noms de conducteurs"), this); + ShortcutManager::instance().registerAction(m_project_export_conductor_num, "diagrameditor.export_conductor_names", tr("Éditeur de schémas"), QKeySequence()); connect(m_project_export_conductor_num, &QAction::triggered, [this]() { QETProject *project = this->currentProject(); if (project) @@ -727,6 +743,7 @@ void QETDiagramEditor::setUpActions() }); // Export wiring list to CSV m_project_export_wiring_list = new QAction(QET::Icons::DocumentSpreadsheet, tr("Exporter le plan de câblage"), this); + ShortcutManager::instance().registerAction(m_project_export_wiring_list, "diagrameditor.export_wiring_list", tr("Éditeur de schémas"), QKeySequence()); connect(m_project_export_wiring_list, &QAction::triggered, [this]() { QETProject *project = this->currentProject(); if (project) @@ -738,6 +755,7 @@ void QETDiagramEditor::setUpActions() // Show the wiring list read from the project database m_project_wiring_list_view = new QAction(QET::Icons::DocumentSpreadsheet, tr("Liste de câblage (base de données)"), this); + ShortcutManager::instance().registerAction(m_project_wiring_list_view, "diagrameditor.wiring_list_view", tr("Éditeur de schémas"), QKeySequence()); connect(m_project_wiring_list_view, &QAction::triggered, [this]() { QETProject *project = this->currentProject(); if (project) @@ -749,10 +767,12 @@ void QETDiagramEditor::setUpActions() // Terminal Numbering m_terminal_numbering = new QAction(QET::Icons::TerminalStrip, tr("Numérotation automatique des bornes"), this); + ShortcutManager::instance().registerAction(m_terminal_numbering, "diagrameditor.terminal_numbering", tr("Éditeur de schémas"), QKeySequence()); connect(m_terminal_numbering, &QAction::triggered, this, &QETDiagramEditor::slot_terminalNumbering); // Reload element drawings from their current definition (bugtracker #802) m_reload_element_drawings = new QAction(QET::Icons::ViewRefresh, tr("Recharger les dessins des éléments"), this); + ShortcutManager::instance().registerAction(m_reload_element_drawings, "diagrameditor.reload_element_drawings", tr("Éditeur de schémas"), QKeySequence()); m_reload_element_drawings->setStatusTip( tr("Redessine chaque élément placé d'après sa définition actuelle," " sans avoir à fermer et rouvrir le projet (action non annulable)")); @@ -761,6 +781,7 @@ void QETDiagramEditor::setUpActions() #ifdef QET_HAS_SCRIPTING // Run a JavaScript macro against the current project (bugtracker #162). m_run_script = new QAction(tr("Exécuter un script..."), this); + ShortcutManager::instance().registerAction(m_run_script, "diagrameditor.run_script", tr("Éditeur de schémas"), QKeySequence()); m_run_script->setStatusTip( tr("Exécute un script JavaScript sur le projet courant (voir qet.*" " dans le script pour l'API disponible)")); @@ -811,6 +832,7 @@ void QETDiagramEditor::setUpActions() //Stored scripts are files in a folder, written by hand, by the //script manager or by an assistant: open it to add one. m_open_scripts_folder = new QAction(QET::Icons::FolderOpen, tr("Ouvrir le dossier des scripts"), this); + ShortcutManager::instance().registerAction(m_open_scripts_folder, "diagrameditor.open_scripts_folder", tr("Éditeur de schémas"), QKeySequence()); m_open_scripts_folder->setStatusTip( tr("Chaque fichier .js de ce dossier qui commence par un en-tête" " // ==QETScript== devient un bouton")); @@ -822,6 +844,7 @@ void QETDiagramEditor::setUpActions() #ifdef QET_EXPORT_PROJECT_DB m_export_project_db = new QAction(QET::Icons::DocumentSpreadsheet, tr("Exporter la base de donnée interne du projet"), this); + ShortcutManager::instance().registerAction(m_export_project_db, "diagrameditor.export_project_db", tr("Éditeur de schémas"), QKeySequence()); connect(m_export_project_db, &QAction::triggered, [this]() { projectDataBase::exportDb(this->currentProject()->dataBase(), this); }); @@ -829,11 +852,13 @@ void QETDiagramEditor::setUpActions() //MDI view style m_tabbed_view_mode = new QAction(tr("en utilisant des onglets"), this); + ShortcutManager::instance().registerAction(m_tabbed_view_mode, "diagrameditor.tabbed_view_mode", tr("Éditeur de schémas"), QKeySequence()); m_tabbed_view_mode->setStatusTip(tr("Présente les différents projets ouverts des onglets", "status bar tip")); m_tabbed_view_mode->setCheckable(true); connect(m_tabbed_view_mode, &QAction::triggered, this, &QETDiagramEditor::setTabbedMode); m_windowed_view_mode = new QAction(tr("en utilisant des fenêtres"), this); + ShortcutManager::instance().registerAction(m_windowed_view_mode, "diagrameditor.windowed_view_mode", tr("Éditeur de schémas"), QKeySequence()); m_windowed_view_mode->setStatusTip(tr("Présente les différents projets ouverts dans des sous-fenêtres", "status bar tip")); m_windowed_view_mode->setCheckable(true); connect(m_windowed_view_mode, &QAction::triggered, this, &QETDiagramEditor::setWindowedMode); @@ -844,15 +869,18 @@ void QETDiagramEditor::setUpActions() m_group_view_mode -> setExclusive(true); m_tile_window = new QAction(tr("&Mosaïque"), this); + ShortcutManager::instance().registerAction(m_tile_window, "diagrameditor.tile_windows", tr("Éditeur de schémas"), QKeySequence()); m_tile_window->setStatusTip(tr("Dispose les fenêtres en mosaïque", "status bar tip")); connect(m_tile_window, &QAction::triggered, &m_workspace, &QMdiArea::tileSubWindows); m_cascade_window = new QAction(tr("&Cascade"), this); + ShortcutManager::instance().registerAction(m_cascade_window, "diagrameditor.cascade_windows", tr("Éditeur de schémas"), QKeySequence()); m_cascade_window->setStatusTip(tr("Dispose les fenêtres en cascade", "status bar tip")); connect(m_cascade_window, &QAction::triggered, &m_workspace, &QMdiArea::cascadeSubWindows); //Switch selection/view mode m_mode_selection = new QAction(QET::Icons::PartSelect, tr("Mode Selection"), this); + ShortcutManager::instance().registerAction(m_mode_selection, "diagrameditor.mode_selection", tr("Éditeur de schémas"), QKeySequence()); m_mode_selection->setStatusTip(tr("Permet de sélectionner les éléments", "status bar tip")); m_mode_selection->setCheckable(true); m_mode_selection->setChecked(true); @@ -865,6 +893,7 @@ void QETDiagramEditor::setUpActions() }); m_mode_visualise = new QAction(QET::Icons::ViewMove, tr("Mode Visualisation"), this); + ShortcutManager::instance().registerAction(m_mode_visualise, "diagrameditor.mode_visualise", tr("Éditeur de schémas"), QKeySequence()); m_mode_visualise->setStatusTip(tr("Permet de visualiser le folio sans pouvoir le modifier", "status bar tip")); m_mode_visualise->setCheckable(true); connect(m_mode_visualise, &QAction::triggered, [this]() { @@ -936,6 +965,12 @@ void QETDiagramEditor::setUpActions() add_row ->setData("add_row"); remove_row ->setData("remove_row"); + for (QAction *action : m_row_column_actions_group.actions()) { + ShortcutManager::instance().registerAction( + action, "diagrameditor." + action->data().toString(), + tr("Éditeur de schémas"), QKeySequence()); + } + connect(&m_row_column_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::rowColumnGroupTriggered); //Selections Actions (related to a selected item) @@ -953,6 +988,8 @@ void QETDiagramEditor::setUpActions() ShortcutManager::instance().registerAction(m_rotate_selection, "diagrameditor.rotate_selection", tr("Éditeur de schémas"), Qt::Key_Space); ShortcutManager::instance().registerAction(m_rotate_group_selection, "diagrameditor.rotate_group_selection", tr("Éditeur de schémas"), Qt::SHIFT | Qt::Key_Space); ShortcutManager::instance().registerAction(m_rotate_texts, "diagrameditor.rotate_texts", tr("Éditeur de schémas"), Qt::CTRL | Qt::Key_Space); + ShortcutManager::instance().registerAction(m_find_element, "diagrameditor.find_element", tr("Éditeur de schémas"), QKeySequence()); + ShortcutManager::instance().registerAction(m_group_selected_texts, "diagrameditor.group_selected_texts", tr("Éditeur de schémas"), QKeySequence()); ShortcutManager::instance().registerAction(m_edit_selection, "diagrameditor.edit_selection", tr("Éditeur de schémas"), Qt::CTRL | Qt::Key_E); //Re-enter placement mode with the element placed last. Bare A rather diff --git a/sources/qetmainwindow.cpp b/sources/qetmainwindow.cpp index 36fccebf8..3ee58586a 100644 --- a/sources/qetmainwindow.cpp +++ b/sources/qetmainwindow.cpp @@ -69,6 +69,7 @@ void QETMainWindow::initCommonActions() QETApp *qet_app = QETApp::instance(); configure_action_ = new QAction(QET::Icons::Configure, tr("&Configurer QElectroTech"), this); + ShortcutManager::instance().registerAction(configure_action_, "mainwindow.configure", tr("Général"), QKeySequence()); configure_action_ -> setStatusTip(tr("Permet de régler différents paramètres de QElectroTech", "status bar tip")); connect(configure_action_, &QAction::triggered, [qet_app]() { @@ -107,8 +108,10 @@ void QETMainWindow::initCommonActions() connect(fullscreen_action_, &QAction::triggered, this, &QETMainWindow::toggleFullScreen); whatsthis_action_ = QWhatsThis::createAction(this); + ShortcutManager::instance().registerAction(whatsthis_action_, "mainwindow.whats_this", tr("Général"), Qt::SHIFT | Qt::Key_F1); about_qet_ = new QAction(QET::Icons::QETLogo, tr("À &propos de QElectroTech"), this); + ShortcutManager::instance().registerAction(about_qet_, "mainwindow.about_qet", tr("Général"), QKeySequence()); about_qet_ -> setStatusTip(tr("Affiche des informations sur QElectroTech", "status bar tip")); connect(about_qet_, &QAction::triggered, qet_app, &QETApp::aboutQET); @@ -123,6 +126,7 @@ void QETMainWindow::initCommonActions() ShortcutManager::instance().registerAction(manual_online_, "mainwindow.manual_online", tr("Général"), Qt::Key_F1); connect_ai_ = new QAction(tr("Connecter un assistant IA..."), this); + ShortcutManager::instance().registerAction(connect_ai_, "mainwindow.connect_ai", tr("Général"), QKeySequence()); connect_ai_ -> setStatusTip(tr("Affiche la configuration qui permet à un assistant IA d'utiliser QElectroTech", "status bar tip")); connect(connect_ai_, &QAction::triggered, this, [this]() { AiAssistantDialog dialog(this); @@ -130,6 +134,7 @@ void QETMainWindow::initCommonActions() }); youtube_ = new QAction(QET::Icons::QETVideo, tr("Chaine Youtube"), this); + ShortcutManager::instance().registerAction(youtube_, "mainwindow.youtube", tr("Général"), QKeySequence()); youtube_ -> setStatusTip(tr("Lance le navigateur par défaut vers la chaine Youtube de QElectroTech", "status bar tip")); connect(youtube_, &QAction::triggered, [](bool) { @@ -138,9 +143,11 @@ void QETMainWindow::initCommonActions() }); upgrade_ = new QAction(QET::Icons::QETDownload, tr("Télécharger une nouvelle version (dev)"), this); + ShortcutManager::instance().registerAction(upgrade_, "mainwindow.download_windows", tr("Général"), QKeySequence()); upgrade_ -> setStatusTip(tr("Lance le navigateur par défaut vers le dépot Nightly en ligne de QElectroTech", "status bar tip")); upgrade_M = new QAction(QET::Icons::QETDownload, tr("Télécharger une nouvelle version (dev)"), this); + ShortcutManager::instance().registerAction(upgrade_M, "mainwindow.download_mac", tr("Général"), QKeySequence()); upgrade_M -> setStatusTip(tr("Lance le navigateur par défaut vers le dépot Nightly en ligne de QElectroTech", "status bar tip")); connect(upgrade_, &QAction::triggered, [](bool) { @@ -154,6 +161,7 @@ void QETMainWindow::initCommonActions() }); donate_ = new QAction(QET::Icons::QETDonate, tr("Soutenir le projet par un don"), this); + ShortcutManager::instance().registerAction(donate_, "mainwindow.donate", tr("Général"), QKeySequence()); donate_ -> setStatusTip(tr("Soutenir le projet QElectroTech par un don", "status bar tip")); connect(donate_, &QAction::triggered, [](bool) { @@ -162,10 +170,12 @@ void QETMainWindow::initCommonActions() }); about_qt_ = new QAction(QET::Icons::QtLogo, tr("À propos de &Qt"), this); + ShortcutManager::instance().registerAction(about_qt_, "mainwindow.about_qt", tr("Général"), QKeySequence()); about_qt_ -> setStatusTip(tr("Affiche des informations sur la bibliothèque Qt", "status bar tip")); connect(about_qt_, &QAction::triggered, qApp, &QApplication::aboutQt); diagnostics_action_ = new QAction(QET::Icons::DialogInformation, tr("Enregistrer un rapport de diagnostic..."), this); + ShortcutManager::instance().registerAction(diagnostics_action_, "mainwindow.diagnostics_report", tr("Général"), QKeySequence()); diagnostics_action_ -> setStatusTip(tr("Génère un rapport avec les derniers messages de journalisation, pour l'inclure dans un rapport de bug", "status bar tip")); connect(diagnostics_action_, &QAction::triggered, this, []() { QETApp::instance()->showDiagnosticsReport();