Files
qelectrotech-source-mirror/sources/TerminalStrip/GraphicsItem/terminalstripdrawerhelpers.h
T
Laurent Trinques 34557928d1 Terminal strip: realistic drawing styles and separator plates
Add two realistic drawing styles for the terminal strip plan, besides
the existing schematic one:
- Realistic (push-in) and Realistic (screw): the strip seen from above,
  at scale (real width of each terminal), like a cabinet mounting
  drawing: end stops, group marker carrier with the strip name, one row
  of wire entries per level, bridge channels with red bridges, marker
  tags with the terminal number, type symbol (fuse, LED, diode,
  sectional, ground...), green/yellow PE and terminal color.

The style is chosen for each plan in the "Add terminal strip plan"
dialog and saved with the item (attribute draw_style of
terminal_strip_item). Items saved before keep the schematic style.
Several plans of the same strip can use different styles.

The values used by the realistic styles are in the layout (scale in
px/mm, terminal length in mm, end stops, group marker) and can be set
in the layout editor, whose style combo box only changes the preview.

Separator plates: a new "Separator plate after" check box column in
the terminal strip editor, stored in the terminal element informations
(key terminal_separator). Drawn as a plate at scale in the realistic
styles and as a thick line in the schematic style.

New files: realisticterminalstripdrawer.{h,cpp} (realistic drawing) and
terminalstripdrawerhelpers.h (helpers shared with the schematic drawer).
2026-10-17 20:21:35 +02:00

49 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 TERMINALSTRIPDRAWERHELPERS_H
#define TERMINALSTRIPDRAWERHELPERS_H
#include "terminalstripdrawer.h"
class QPainter;
/**
* Functions shared by the drawing styles of a terminal strip
* (schematic style in terminalstripdrawer.cpp, realistic style in realisticterminalstripdrawer.cpp).
*/
namespace TerminalStripDrawer
{
namespace Helpers
{
//Width (mm) of the reference terminal (2.5 mm2), used when the width of a terminal is unknown
qreal referenceTerminalWidthMm();
//Fill color and stripe color (can be invalid) of a terminal
void terminalColors(const QSharedPointer<AbstractRealTerminalInterface> &real_t,
QColor &fill, QColor &stripe);
//Black or white, the more readable on background
QColor contrastColor(const QColor &background);
//Number of a terminal : "1" for "XAUZ1:1"
QString terminalNumber(const QString &label);
//Symbol of the type of the terminal (fuse, diode, led...) scaled to fit in box
void drawTypeSymbol(QPainter *painter, const QRectF &box,
ElementData::TerminalType type, bool led);
}
}
#endif // TERMINALSTRIPDRAWERHELPERS_H