mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-22 06:14:14 +02:00
0a577eaabf
A new command, "Place symbol texts", for the selected symbols: their label and the notes beside it go as one block next to the drawing of the symbol, 3 px away, at one of the nine points of the text alignment dialog, chosen in a 3 x 3 grid that opens from the toolbar button and from the Edit menu. A click on the button places them at the point chosen last (left of the symbol at first). Left of the symbol the lines are aligned right, so that they hang on it and a longer text grows away from it (their alignment is set too); right of it aligned left; above, below and on it centred. The lines keep their order and their spacing, a group of texts is placed as one line with the same alignment, a turned symbol is placed in the folio's directions, and everything is one undo step. Element::drawingRect() gives the area the drawing covers, tighter than the bounding rect, which is rounded up to the grid. A toolbar command with a menu now shows as a button with an arrow beside it. Translations for all languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.8 KiB
C++
53 lines
1.8 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 SYMBOLTEXTPLACEMENT_H
|
|
#define SYMBOLTEXTPLACEMENT_H
|
|
|
|
#include <QList>
|
|
#include <Qt>
|
|
|
|
class Element;
|
|
class QUndoCommand;
|
|
|
|
/**
|
|
Place the texts of a symbol -- its label and the notes beside it -- as
|
|
one block at one of nine points around its drawing, the nine of the
|
|
text alignment dialog. Left of the symbol, the lines are aligned right,
|
|
so that the block hangs on the symbol and a longer text grows away
|
|
from it; right of it, aligned left; above, below and on it, centred.
|
|
The lines keep their order and their spacing; a group of texts is
|
|
placed as one line of the block, with the same alignment.
|
|
*/
|
|
namespace SymbolTextPlacement
|
|
{
|
|
/// Room between the drawing of the symbol and the block
|
|
constexpr double gap = 3;
|
|
|
|
/**
|
|
@param elements : the symbols whose texts to place
|
|
@param where : the side of the drawing, as a 9-point alignment:
|
|
Qt::AlignLeft | Qt::AlignVCenter is left of the symbol, halfway
|
|
up; Qt::AlignCenter is on it
|
|
@return one undo step that places them (already placed), or
|
|
nullptr when none of the symbols has a text
|
|
*/
|
|
QUndoCommand *place(const QList<Element *> &elements, Qt::Alignment where);
|
|
}
|
|
|
|
#endif // SYMBOLTEXTPLACEMENT_H
|