QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
terminalstripdrawer.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef TERMINALSTRIPDRAWER_H
19#define TERMINALSTRIPDRAWER_H
20
21#include <QPointer>
22#include <QUuid>
23
25
26class QPainter;
27class TerminalStrip;
28
29namespace TerminalStripDrawer
30{
38 int physical{-1};
39 int real{-1};
40 };
41
43 {
44 public:
47 virtual QUuid uuid() const = 0;
48 };
49
51 {
52 public:
55 virtual QString label() const = 0;
56 virtual bool isBridged() const = 0;
57 virtual AbstractBridgeInterface* bridge() const = 0;
58 virtual QString xref() const = 0;
59 };
60
62 {
63 public:
66 virtual QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const = 0;
67 };
68
70 {
71 public:
74 virtual QString installation() const = 0;
75 virtual QString location() const = 0;
76 virtual QString name() const = 0;
77 virtual QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> physicalTerminal() const = 0;
78 };
79
81 {
82 public:
83 TerminalStripDrawer(QSharedPointer<AbstractTerminalStripInterface> strip = QSharedPointer<AbstractTerminalStripInterface> { nullptr },
84 QSharedPointer<TerminalStripLayoutPattern> layout = QSharedPointer<TerminalStripLayoutPattern>());
85
86 void setStrip(QSharedPointer<AbstractTerminalStripInterface> strip);
87 void paint(QPainter *painter);
88 QRectF boundingRect() const;
89
90 void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
91 bool haveLayout() const;
92
93 void setPreviewDraw(bool draw = true);
94
95 void setMouseHoverPos(const QPointF &pos);
96 bool mouseHoverXref() const;
97 bool needUpdate();
99
100 private:
101 qreal height() const;
102 qreal width() const;
103
104 private:
105 QSharedPointer <AbstractTerminalStripInterface> m_strip;
106 QSharedPointer<TerminalStripLayoutPattern> m_pattern;
107 bool m_preview_draw { false };
112 };
113}
114
115#endif // TERMINALSTRIPDRAWER_H
Definition terminalstripdrawer.h:43
AbstractBridgeInterface()
Definition terminalstripdrawer.h:45
virtual ~AbstractBridgeInterface()
Definition terminalstripdrawer.h:46
virtual QVector< QSharedPointer< AbstractRealTerminalInterface > > realTerminals() const =0
AbstractPhysicalTerminalInterface()
Definition terminalstripdrawer.h:64
virtual ~AbstractPhysicalTerminalInterface()
Definition terminalstripdrawer.h:65
AbstractRealTerminalInterface()
Definition terminalstripdrawer.h:53
virtual AbstractBridgeInterface * bridge() const =0
virtual ~AbstractRealTerminalInterface()
Definition terminalstripdrawer.h:54
virtual QVector< QSharedPointer< AbstractPhysicalTerminalInterface > > physicalTerminal() const =0
virtual ~AbstractTerminalStripInterface()
Definition terminalstripdrawer.h:73
AbstractTerminalStripInterface()
Definition terminalstripdrawer.h:72
void setPreviewDraw(bool draw=true)
Definition terminalstripdrawer.cpp:296
void setMouseHoverPos(const QPointF &pos)
Definition terminalstripdrawer.cpp:300
qreal width() const
Definition terminalstripdrawer.cpp:353
QSharedPointer< AbstractTerminalStripInterface > m_strip
Definition terminalstripdrawer.h:105
hoverTerminal m_hovered_xref
Definition terminalstripdrawer.h:111
qreal height() const
Definition terminalstripdrawer.cpp:335
QRectF m_united_xref_text_rect
Definition terminalstripdrawer.h:109
QRectF boundingRect() const
Definition terminalstripdrawer.cpp:281
bool m_preview_draw
Definition terminalstripdrawer.h:107
bool needUpdate()
Definition terminalstripdrawer.cpp:315
QPointF m_mouse_hover_pos
Definition terminalstripdrawer.h:108
void paint(QPainter *painter)
TerminalStripDrawer::paint.
Definition terminalstripdrawer.cpp:45
bool mouseHoverXref() const
TerminalStripDrawer::mouseHoverXref.
Definition terminalstripdrawer.cpp:311
void setLayout(QSharedPointer< TerminalStripLayoutPattern > layout)
Definition terminalstripdrawer.cpp:286
hoverTerminal hoveredXref() const
TerminalStripDrawer::hoveredXref.
Definition terminalstripdrawer.cpp:330
QSharedPointer< TerminalStripLayoutPattern > m_pattern
Definition terminalstripdrawer.h:106
bool m_last_mouse_pos_in_xrefs_rect
Definition terminalstripdrawer.h:110
bool haveLayout() const
Definition terminalstripdrawer.cpp:291
void setStrip(QSharedPointer< AbstractTerminalStripInterface > strip)
Definition terminalstripdrawer.cpp:36
The TerminalStrip class This class hold all the datas and configurations of a terminal strip (but the...
Definition terminalstrip.h:45
Definition demoterminalstrip.cpp:21
The hoverTerminal struct Just a little struct use to know what is the physical and real terminal when...
Definition terminalstripdrawer.h:37
int real
Definition terminalstripdrawer.h:39
int physical
Definition terminalstripdrawer.h:38