2022-08-27 21:24:25 +02:00
|
|
|
/*
|
|
|
|
Copyright 2006-2022 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 TERMINALSTRIPITEM_H
|
|
|
|
#define TERMINALSTRIPITEM_H
|
|
|
|
|
|
|
|
#include <QGraphicsObject>
|
2022-12-21 19:18:49 +01:00
|
|
|
#include <QUuid>
|
2022-08-27 21:24:25 +02:00
|
|
|
|
2022-12-02 19:35:17 +01:00
|
|
|
#include "terminalstripdrawer.h"
|
2022-08-27 21:24:25 +02:00
|
|
|
#include "../../qetgraphicsitem/qetgraphicsitem.h"
|
|
|
|
|
|
|
|
class TerminalStrip;
|
|
|
|
|
|
|
|
class TerminalStripItem : public QetGraphicsItem
|
|
|
|
{
|
2022-12-21 19:18:49 +01:00
|
|
|
friend class TerminalStripItemXml;
|
|
|
|
|
2022-08-27 21:24:25 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
TerminalStripItem(QPointer<TerminalStrip> strip, QGraphicsItem *parent = nullptr);
|
2022-12-21 19:18:49 +01:00
|
|
|
TerminalStripItem(QGraphicsItem *parent = nullptr);
|
|
|
|
|
|
|
|
void setTerminalStrip(TerminalStrip *strip);
|
|
|
|
QPointer<TerminalStrip> terminalStrip() const;
|
2022-08-27 21:24:25 +02:00
|
|
|
|
2022-11-08 19:20:32 +01:00
|
|
|
enum {Type = UserType + 1011};
|
|
|
|
int type() const override {return Type;}
|
|
|
|
|
2022-08-27 21:24:25 +02:00
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
|
|
QRectF boundingRect() const override;
|
2022-11-08 19:20:32 +01:00
|
|
|
QString name() const override;
|
2022-08-27 21:24:25 +02:00
|
|
|
|
2022-12-02 18:12:47 +01:00
|
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
2022-12-21 19:18:49 +01:00
|
|
|
void refreshPending();
|
2023-01-04 22:40:18 +01:00
|
|
|
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setDefaultLayout();
|
|
|
|
|
2022-08-27 21:24:25 +02:00
|
|
|
private:
|
|
|
|
QPointer<TerminalStrip> m_strip;
|
2023-05-15 22:22:12 +02:00
|
|
|
TerminalStripDrawer::TerminalStripDrawer m_drawer;
|
2022-12-21 19:18:49 +01:00
|
|
|
QUuid m_pending_strip_uuid;
|
2022-08-27 21:24:25 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TERMINALSTRIPITEM_H
|