QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
terminalstripitem.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 TERMINALSTRIPITEM_H
19#define TERMINALSTRIPITEM_H
20
21#include <QGraphicsObject>
22#include <QUuid>
23
24#include "terminalstripdrawer.h"
26
27class TerminalStrip;
28
30{
32
33 Q_OBJECT
34
35 public:
36 TerminalStripItem(QPointer<TerminalStrip> strip, QGraphicsItem *parent = nullptr);
37 TerminalStripItem(QGraphicsItem *parent = nullptr);
38
40 QPointer<TerminalStrip> terminalStrip() const;
41
42 enum {Type = UserType + 1011};
43 int type() const override {return Type;}
44
45 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
46 QRectF boundingRect() const override;
47 QString name() const override;
48
49 void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
50 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
51 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
52 void refreshPending();
53 void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
54
55 private:
56 void setDefaultLayout();
57
58 private:
59 QPointer<TerminalStrip> m_strip;
62};
63
64#endif // TERMINALSTRIPITEM_H
QetGraphicsItem(QGraphicsItem *parent=nullptr)
Definition qetgraphicsitem.cpp:44
Definition terminalstripdrawer.h:81
The TerminalStrip class This class hold all the datas and configurations of a terminal strip (but the...
Definition terminalstrip.h:45
void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override
Definition terminalstripitem.cpp:99
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
Definition terminalstripitem.cpp:108
@ Type
Definition terminalstripitem.h:42
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Definition terminalstripitem.cpp:70
QUuid m_pending_strip_uuid
Definition terminalstripitem.h:61
void setTerminalStrip(TerminalStrip *strip)
Definition terminalstripitem.cpp:50
friend class TerminalStripItemXml
Definition terminalstripitem.h:31
QPointer< TerminalStrip > m_strip
Definition terminalstripitem.h:59
int type() const override
Definition terminalstripitem.h:43
void refreshPending()
Definition terminalstripitem.cpp:148
void setDefaultLayout()
Definition terminalstripitem.cpp:169
TerminalStripDrawer::TerminalStripDrawer m_drawer
Definition terminalstripitem.h:60
QRectF boundingRect() const override
Definition terminalstripitem.cpp:83
QPointer< TerminalStrip > terminalStrip() const
TerminalStripItem::terminalStrip.
Definition terminalstripitem.cpp:66
void setLayout(QSharedPointer< TerminalStripLayoutPattern > layout)
Definition terminalstripitem.cpp:164
QString name() const override
TerminalStripItem::name.
Definition terminalstripitem.cpp:95
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
Definition terminalstripitem.cpp:114
TerminalStripItem(QPointer< TerminalStrip > strip, QGraphicsItem *parent=nullptr)
Definition terminalstripitem.cpp:30