mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-05 02:24:13 +02:00
Place an element from the collection without dragging it
DiagramEventAddElement is already a good placement mode: the element follows the cursor on the grid, a left click drops it, Space rotates it, and it stays loaded for a run of the same symbol. Its only caller was DiagramView::handleElementDrop(), so it could be reached only by finishing a drag. Double-clicking a symbol in the Collections dock opened the element editor instead. - DiagramView::startElementPlacement() is split out of handleElementDrop(). defaultPlacementPos() uses the cursor when it is over the view and the centre of the visible area otherwise. - ElementsCollectionWidget emits insertElementRequested() on double click, or Enter on the highlighted item. The host decides which view receives it, so the widget can later be reused outside the editor. - When there is nowhere to place it (no folio open, read-only project), the element editor opens, as a double click did before. - "Insérer le dernier élément" (Édition menu, default key A) places the last element again. DiagramView reports every placement it starts, so an element dropped by drag counts too. Macros are not remembered. A rather than Space: Space rotates the pending element inside placement mode and is bound three more times in this editor. The key is a ShortcutManager default and can be changed in the Shortcuts page. Double click placing is a behaviour change, so it has a preference, "elementscollection/double-click-inserts" (default true), shown in Configuration as an opt-out: "Double-cliquer dans la collection ouvre l'éditeur d'élément au lieu de l'insérer". Discussions #676 and #1033. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G2d2Zi8BfrYRPX88zhaoFG
This commit is contained in:
@@ -86,9 +86,22 @@ class ElementsCollectionWidget : public QWidget
|
||||
public slots:
|
||||
void reload();
|
||||
void loadingFinished();
|
||||
void insertCurrentElement();
|
||||
void editLocation(const ElementsLocation &location);
|
||||
|
||||
signals:
|
||||
/**
|
||||
Emitted when the user asks for an element to be placed on the
|
||||
current folio. Whoever hosts this widget decides which view
|
||||
receives it -- the dock is inside a diagram editor, but the
|
||||
picker popup is not, so the widget must not reach for an
|
||||
ancestor editor itself.
|
||||
*/
|
||||
void insertElementRequested(const ElementsLocation &location);
|
||||
|
||||
private:
|
||||
void locationWasSaved(const ElementsLocation& location);
|
||||
void activateIndex(const QModelIndex &index);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user