mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-13 10:04:13 +02:00
c0896c7ba7
"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.
129 lines
3.7 KiB
C++
129 lines
3.7 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef ELEMENTS_PANEL_WIDGET_H
|
|
#define ELEMENTS_PANEL_WIDGET_H
|
|
|
|
#include "elementspanel.h"
|
|
|
|
/**
|
|
@brief The ElementsPanelWidget class
|
|
This class embeds an elements panel under a toolbar
|
|
providing various actions to manage elements.
|
|
@see ElementsPanel
|
|
*/
|
|
class ElementsPanelWidget : public QWidget {
|
|
Q_OBJECT
|
|
|
|
// constructors, destructor
|
|
public:
|
|
ElementsPanelWidget(QWidget * = nullptr);
|
|
~ElementsPanelWidget() override;
|
|
|
|
private:
|
|
ElementsPanelWidget(const ElementsPanelWidget &);
|
|
|
|
// attributes
|
|
private:
|
|
ElementsPanel *elements_panel;
|
|
QAction *open_directory, *copy_path;
|
|
QAction *prj_activate,
|
|
*prj_close,
|
|
*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,
|
|
*prj_move_diagram_top,
|
|
*prj_move_diagram_down,
|
|
*prj_move_diagram_upx10,
|
|
*prj_move_diagram_upx100,
|
|
*prj_move_diagram_downx10,
|
|
*prj_move_diagram_downx100;
|
|
QAction *tbt_add, *tbt_edit, *tbt_remove;
|
|
QMenu *context_menu;
|
|
QLineEdit *filter_textfield;
|
|
|
|
// methods
|
|
public:
|
|
inline ElementsPanel &elementsPanel() const;
|
|
|
|
signals:
|
|
void requestForProject(QETProject *);
|
|
void requestForNewDiagram(QETProject *);
|
|
void requestForNewDiagramAt(QETProject *, int);
|
|
void requestForProjectClosing(QETProject *);
|
|
void requestForProjectPropertiesEdition(QETProject *);
|
|
void requestForDiagramPropertiesEdition(Diagram *);
|
|
void requestForDiagramDeletion(Diagram *);
|
|
void requestForDiagramsDeletion(const QList<Diagram *> &diagrams);
|
|
void requestForDiagramMoveUp(const QList<Diagram *> &diagrams);
|
|
void requestForDiagramMoveDown(const QList<Diagram *> &diagrams);
|
|
void requestForDiagramMoveUpTop(const QList<Diagram *> &diagrams);
|
|
void requestForDiagramMoveUpx10(const QList<Diagram *> &diagrams);
|
|
void requestForDiagramMoveUpx100(const QList<Diagram *> &diagrams);
|
|
void requestForDiagramMoveDownx10(const QList<Diagram *> &diagrams);
|
|
void requestForDiagramMoveDownx100(const QList<Diagram *> &diagrams);
|
|
|
|
public slots:
|
|
void openDirectoryForSelectedItem();
|
|
void copyPathForSelectedItem();
|
|
void reloadAndFilter();
|
|
void activateProject();
|
|
void closeProject();
|
|
void editProjectProperties();
|
|
void editDiagramProperties();
|
|
void newDiagram();
|
|
void insertDiagramAbove();
|
|
void insertDiagramBelow();
|
|
void deleteDiagram();
|
|
void duplicateDiagram();
|
|
void moveDiagramUp();
|
|
void moveDiagramDown();
|
|
void moveDiagramUpTop();
|
|
void moveDiagramUpx10();
|
|
void moveDiagramUpx100();
|
|
void moveDiagramDownx10();
|
|
void moveDiagramDownx100();
|
|
void addTitleBlockTemplate();
|
|
void editTitleBlockTemplate();
|
|
void removeTitleBlockTemplate();
|
|
void updateButtons();
|
|
void handleContextMenu(const QPoint &);
|
|
void filterEdited(const QString &);
|
|
|
|
protected:
|
|
void keyPressEvent (QKeyEvent *e) override;
|
|
|
|
private:
|
|
QString previous_filter_;
|
|
};
|
|
|
|
/**
|
|
@brief ElementsPanelWidget::elementsPanel
|
|
@return The elements panel embedded within this widget.
|
|
*/
|
|
inline ElementsPanel &ElementsPanelWidget::elementsPanel() const
|
|
{
|
|
return(*elements_panel);
|
|
}
|
|
|
|
#endif
|