Add "Insert folio above/below" to the elements panel's folio menu

"Add folio" always appends to the end of the project, ignoring
whatever folio is currently selected in the left panel -- even though
the panel already tracks the selected diagram's position for its
existing move up/down/top actions, and QETProject::addNewDiagram(pos)
already accepts an arbitrary insertion index, pushed as an undoable
AddDiagramCommand (QetGraphicsTableFactory::create() already relies on
this exact mechanism to insert a folio right after a specific one).

Add two new context-menu actions that compute the target position from
the selected diagram's folioIndex() and pass it straight through the
existing machinery -- no changes needed to QETProject or
AddDiagramCommand. New requestForNewDiagramAt/addDiagramToProjectAt
signal/slot pair added alongside the existing
requestForNewDiagram/addDiagramToProject rather than changing it, so
the plain "Add folio" action's append-at-end behavior is untouched.
This commit is contained in:
ispyisail
2026-08-04 16:36:23 +12:00
parent 7307a59c10
commit c0896c7ba7
4 changed files with 60 additions and 0 deletions
+5
View File
@@ -46,6 +46,8 @@ class ElementsPanelWidget : public QWidget {
*prj_edit_prop,
*prj_prop_diagram,
*prj_add_diagram,
*prj_insert_diagram_above,
*prj_insert_diagram_below,
*prj_del_diagram,
*prj_duplicate_diagram,
*prj_move_diagram_up,
@@ -66,6 +68,7 @@ class ElementsPanelWidget : public QWidget {
signals:
void requestForProject(QETProject *);
void requestForNewDiagram(QETProject *);
void requestForNewDiagramAt(QETProject *, int);
void requestForProjectClosing(QETProject *);
void requestForProjectPropertiesEdition(QETProject *);
void requestForDiagramPropertiesEdition(Diagram *);
@@ -88,6 +91,8 @@ class ElementsPanelWidget : public QWidget {
void editProjectProperties();
void editDiagramProperties();
void newDiagram();
void insertDiagramAbove();
void insertDiagramBelow();
void deleteDiagram();
void duplicateDiagram();
void moveDiagramUp();