Files
qelectrotech-source-mirror/sources/editor/ui/scaleelementdialog.h
T
ispyisail 35162b6731 Add "Scale element..." to the element editor, keeping terminals on the grid
Edit > Scale element... scales the whole element about its hotspot by a
factor picked from x0.5, x1.5, x2, x2.5, x3, x4. Only the factors that
leave every terminal on the 10 px folio grid are offered, so wires to a
scaled element stay straight. An element whose terminals are off the grid
today is offered only the factors that bring them on to it; if none does,
the dialog says so and OK is disabled.

Drawn parts are scaled with their existing handleUserTransformation(), as
the resize handles do. Texts, dynamic text fields and terminals are set
directly so that font sizes (whole points, 4 pt minimum), terminal name
offsets and line end sizes scale too, which the resize handles do not do.
One undo step restores the element.

Unlike "Import an element to resize", this needs no external program and
works on the element being edited.

Grew out of issue #1338.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:12:48 +13:00

48 lines
1.3 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 SCALEELEMENTDIALOG_H
#define SCALEELEMENTDIALOG_H
#include <QDialog>
class QCheckBox;
class QComboBox;
/**
@brief The ScaleElementDialog class
Asks for the factor to scale the whole element by. Only the factors
that leave every terminal on the folio grid are offered
(see SymbolScale::safeFactors()).
*/
class ScaleElementDialog : public QDialog
{
Q_OBJECT
public:
ScaleElementDialog(const QList<QPointF> &terminals, QWidget *parent = nullptr);
qreal factor() const;
bool scaleText() const;
private:
QComboBox *m_factor = nullptr;
QCheckBox *m_scale_text = nullptr;
};
#endif // SCALEELEMENTDIALOG_H