mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
When user hover the Xref string of a terminal, the string color change to blue to advise user the xref is clickable. Double click on the blue Xref go the folio of the terminal and zoom the view to the terminal.
65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
/*
|
|
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>
|
|
#include <QUuid>
|
|
|
|
#include "terminalstripdrawer.h"
|
|
#include "../../qetgraphicsitem/qetgraphicsitem.h"
|
|
|
|
class TerminalStrip;
|
|
|
|
class TerminalStripItem : public QetGraphicsItem
|
|
{
|
|
friend class TerminalStripItemXml;
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
TerminalStripItem(QPointer<TerminalStrip> strip, QGraphicsItem *parent = nullptr);
|
|
TerminalStripItem(QGraphicsItem *parent = nullptr);
|
|
|
|
void setTerminalStrip(TerminalStrip *strip);
|
|
QPointer<TerminalStrip> terminalStrip() const;
|
|
|
|
enum {Type = UserType + 1011};
|
|
int type() const override {return Type;}
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
QRectF boundingRect() const override;
|
|
QString name() const override;
|
|
|
|
void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
|
void refreshPending();
|
|
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
|
|
|
private:
|
|
void setDefaultLayout();
|
|
|
|
private:
|
|
QPointer<TerminalStrip> m_strip;
|
|
TerminalStripDrawer::TerminalStripDrawer m_drawer;
|
|
QUuid m_pending_strip_uuid;
|
|
};
|
|
|
|
#endif // TERMINALSTRIPITEM_H
|