umbrello 26.07.70-c53146a Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

diagramproxywidget.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2019-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef DIAGRAMPROXYWIDGET_H
7#define DIAGRAMPROXYWIDGET_H
8
9#include <basictypes.h>
10
11#include <QPointer>
12#include <QPointF>
13#include <QRectF>
14#include <QGraphicsSceneEvent>
15
16 class UMLWidget;
17 class UMLScene;
18 class IDChangeLog;
19 class QAction;
20 class QDomDocument;
21 class QDomElement;
22 class QStyleOptionGraphicsItem;
23 class QXmlStreamWriter;
24
25 class DiagramProxyWidget {
26 public:
27 DiagramProxyWidget(UMLWidget *widget, qreal borderWidth = 5);
28 virtual ~DiagramProxyWidget() {}
29 Uml::ID::Type diagramLink() const;
30 UMLScene *linkedDiagram() const;
31 bool setDiagramLink(const Uml::ID::Type &id);
32 const QRectF &clientRect() const;
33 const QRectF &sceneRect() const;
34 void setClientRect(const QRectF &rect);
35
36 bool isProxyWidget() const;
37 UMLWidget *getProxiedWidget(const QPointF &p) const;
38 QPointF mapFromClient(const QPointF &p) const;
39 QRectF mapFromClient(const QRectF &r) const;
40 QPointF mapToClient(const QPointF &pos) const;
41
42 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
43
44 bool showLinkedDiagram() const;
45 void setShowLinkedDiagram(bool showLinkedDiagram);
46
47 QRectF iconRect() const;
48 void setIconRect(const QRectF &iconRect);
49
50 protected:
51 DiagramProxyWidget& operator=(const DiagramProxyWidget& other);
52 bool activate(IDChangeLog *changeLog = nullptr);
53 bool loadFromXMI(QDomElement &qElement);
54 void saveToXMI(QXmlStreamWriter& writer);
55 void setupEvent(QGraphicsSceneMouseEvent &e,
56 const QGraphicsSceneMouseEvent *event, const QPointF &pos) const;
57 void setupEvent(QGraphicsSceneContextMenuEvent &e,
58 const QGraphicsSceneContextMenuEvent *event, const QPointF &pos) const;
59 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
60 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
61 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
62 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
63 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
64 void slotMenuSelection(QAction *action);
65
66 private:
67 Uml::ID::Type m_diagramLinkId;
68 QPointer<UMLScene> m_linkedDiagram;
69 QRectF m_clientRect;
70 QRectF m_sceneRect;
71 QRectF m_iconRect;
72 UMLWidget *m_widget;
73 qreal m_borderWidth;
74 bool m_showLinkedDiagram;
75};
76
77#endif // DIAGRAMPROXYWIDGET_H
basictypes.h
DiagramProxyWidget
Definition: diagramproxywidget.h:25
DiagramProxyWidget::mapToClient
QPointF mapToClient(const QPointF &pos) const
Definition: diagramproxywidget.cpp:153
DiagramProxyWidget::diagramLink
Uml::ID::Type diagramLink() const
Definition: diagramproxywidget.cpp:36
DiagramProxyWidget::loadFromXMI
bool loadFromXMI(QDomElement &qElement)
Definition: diagramproxywidget.cpp:102
DiagramProxyWidget::showLinkedDiagram
bool showLinkedDiagram() const
Definition: diagramproxywidget.cpp:304
DiagramProxyWidget::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
Definition: diagramproxywidget.cpp:325
DiagramProxyWidget::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:270
DiagramProxyWidget::contextMenuEvent
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition: diagramproxywidget.cpp:213
DiagramProxyWidget::m_showLinkedDiagram
bool m_showLinkedDiagram
Definition: diagramproxywidget.h:74
DiagramProxyWidget::mapFromClient
QPointF mapFromClient(const QPointF &p) const
Definition: diagramproxywidget.cpp:132
DiagramProxyWidget::setIconRect
void setIconRect(const QRectF &iconRect)
Definition: diagramproxywidget.cpp:295
DiagramProxyWidget::m_borderWidth
qreal m_borderWidth
Definition: diagramproxywidget.h:73
DiagramProxyWidget::sceneRect
const QRectF & sceneRect() const
Definition: diagramproxywidget.cpp:78
DiagramProxyWidget::isProxyWidget
bool isProxyWidget() const
Definition: diagramproxywidget.cpp:115
DiagramProxyWidget::setupEvent
void setupEvent(QGraphicsSceneMouseEvent &e, const QGraphicsSceneMouseEvent *event, const QPointF &pos) const
Definition: diagramproxywidget.cpp:180
DiagramProxyWidget::iconRect
QRectF iconRect() const
Definition: diagramproxywidget.cpp:286
DiagramProxyWidget::setClientRect
void setClientRect(const QRectF &rect)
Definition: diagramproxywidget.cpp:88
DiagramProxyWidget::m_iconRect
QRectF m_iconRect
widget area for diagram icon
Definition: diagramproxywidget.h:71
DiagramProxyWidget::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:258
DiagramProxyWidget::getProxiedWidget
UMLWidget * getProxiedWidget(const QPointF &p) const
Definition: diagramproxywidget.cpp:120
DiagramProxyWidget::m_widget
UMLWidget * m_widget
Definition: diagramproxywidget.h:72
DiagramProxyWidget::slotMenuSelection
void slotMenuSelection(QAction *action)
Definition: diagramproxywidget.cpp:352
DiagramProxyWidget::operator=
DiagramProxyWidget & operator=(const DiagramProxyWidget &other)
Definition: diagramproxywidget.cpp:163
DiagramProxyWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:225
DiagramProxyWidget::m_diagramLinkId
Uml::ID::Type m_diagramLinkId
id of linked diagram
Definition: diagramproxywidget.h:67
DiagramProxyWidget::linkedDiagram
UMLScene * linkedDiagram() const
Definition: diagramproxywidget.cpp:41
DiagramProxyWidget::clientRect
const QRectF & clientRect() const
Definition: diagramproxywidget.cpp:68
DiagramProxyWidget::m_linkedDiagram
QPointer< UMLScene > m_linkedDiagram
pointer to linked diagram
Definition: diagramproxywidget.h:68
DiagramProxyWidget::setShowLinkedDiagram
void setShowLinkedDiagram(bool showLinkedDiagram)
Definition: diagramproxywidget.cpp:313
DiagramProxyWidget::setDiagramLink
bool setDiagramLink(const Uml::ID::Type &id)
Definition: diagramproxywidget.cpp:46
DiagramProxyWidget::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:246
DiagramProxyWidget::m_clientRect
QRectF m_clientRect
widget area for embedded diagram
Definition: diagramproxywidget.h:69
DiagramProxyWidget::~DiagramProxyWidget
virtual ~DiagramProxyWidget()
Definition: diagramproxywidget.h:28
DiagramProxyWidget::saveToXMI
void saveToXMI(QXmlStreamWriter &writer)
Definition: diagramproxywidget.cpp:109
DiagramProxyWidget::m_sceneRect
QRectF m_sceneRect
scene rectangle used for internal calculations
Definition: diagramproxywidget.h:70
DiagramProxyWidget::activate
bool activate(IDChangeLog *changeLog=nullptr)
Definition: diagramproxywidget.cpp:93
IDChangeLog
Definition: idchangelog.h:22
UMLScene
Definition: umlscene.h:66
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:36
Uml::ID::Type
std::string Type
Definition: basictypes.h:371