umbrello: umbrello/umlwidgets/diagramproxywidget.h Source File

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

diagramproxywidget.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2019-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef DIAGRAMPROXYWIDGET_H
12 #define DIAGRAMPROXYWIDGET_H
13
14 #include <basictypes.h>
15
16 #include <QPointer>
17 #include <QPointF>
18 #include <QRectF>
19 #include <QGraphicsSceneEvent>
20
21 class UMLWidget;
22 class UMLScene;
23 class IDChangeLog;
24 class QAction;
25 class QDomDocument;
26 class QDomElement;
27 class QStyleOptionGraphicsItem;
28 class QXmlStreamWriter;
29
30 class DiagramProxyWidget {
31 public:
32 DiagramProxyWidget(UMLWidget *widget, qreal borderWidth = 5);
33 virtual ~DiagramProxyWidget() {}
34 Uml::ID::Type diagramLink() const;
35 UMLScene *linkedDiagram() const;
36 bool setDiagramLink(const Uml::ID::Type &id);
37 const QRectF &clientRect();
38 const QRectF &sceneRect();
39 void setClientRect(const QRectF &rect);
40
41 bool isProxyWidget();
42 UMLWidget *getProxiedWidget(const QPointF &p);
43 QPointF mapFromClient(const QPointF &p);
44 QRectF mapFromClient(const QRectF &r);
45 QPointF mapToClient(const QPointF &pos);
46
47 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
48
49 bool showLinkedDiagram() const;
50 void setShowLinkedDiagram(bool showLinkedDiagram);
51
52 QRectF iconRect() const;
53 void setIconRect(const QRectF &iconRect);
54
55 protected:
56 DiagramProxyWidget& operator=(const DiagramProxyWidget& other);
57 bool activate(IDChangeLog* changeLog = 0);
58 bool loadFromXMI1(QDomElement &qElement);
59 void saveToXMI1(QXmlStreamWriter& writer);
60 void setupEvent(QGraphicsSceneMouseEvent &e, QGraphicsSceneMouseEvent *event, const QPointF &pos);
61 void setupEvent(QGraphicsSceneContextMenuEvent &e, QGraphicsSceneContextMenuEvent *event, const QPointF &pos);
62 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
63 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
64 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
65 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
66 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
67 void slotMenuSelection(QAction *action);
68
69 private:
70 Uml::ID::Type m_diagramLinkId;
71 QPointer<UMLScene> m_linkedDiagram;
72 QRectF m_clientRect;
73 QRectF m_sceneRect;
74 QRectF m_iconRect;
75 UMLWidget *m_widget;
76 qreal m_borderWidth;
77 bool m_showLinkedDiagram;
78 };
79
80 #endif // DIAGRAMPROXYWIDGET_H
basictypes.h
DiagramProxyWidget
Definition: diagramproxywidget.h:30
DiagramProxyWidget::diagramLink
Uml::ID::Type diagramLink() const
Definition: diagramproxywidget.cpp:41
DiagramProxyWidget::clientRect
const QRectF & clientRect()
Definition: diagramproxywidget.cpp:73
DiagramProxyWidget::sceneRect
const QRectF & sceneRect()
Definition: diagramproxywidget.cpp:83
DiagramProxyWidget::showLinkedDiagram
bool showLinkedDiagram() const
Definition: diagramproxywidget.cpp:307
DiagramProxyWidget::activate
bool activate(IDChangeLog *changeLog=0)
Definition: diagramproxywidget.cpp:98
DiagramProxyWidget::mapFromClient
QPointF mapFromClient(const QPointF &p)
Definition: diagramproxywidget.cpp:137
DiagramProxyWidget::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:273
DiagramProxyWidget::contextMenuEvent
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition: diagramproxywidget.cpp:216
DiagramProxyWidget::m_showLinkedDiagram
bool m_showLinkedDiagram
Definition: diagramproxywidget.h:77
DiagramProxyWidget::getProxiedWidget
UMLWidget * getProxiedWidget(const QPointF &p)
Definition: diagramproxywidget.cpp:125
DiagramProxyWidget::setIconRect
void setIconRect(const QRectF &iconRect)
Definition: diagramproxywidget.cpp:298
DiagramProxyWidget::m_borderWidth
qreal m_borderWidth
Definition: diagramproxywidget.h:76
DiagramProxyWidget::iconRect
QRectF iconRect() const
Definition: diagramproxywidget.cpp:289
DiagramProxyWidget::setClientRect
void setClientRect(const QRectF &rect)
Definition: diagramproxywidget.cpp:93
DiagramProxyWidget::isProxyWidget
bool isProxyWidget()
Definition: diagramproxywidget.cpp:120
DiagramProxyWidget::m_iconRect
QRectF m_iconRect
widget area for diagram icon
Definition: diagramproxywidget.h:74
DiagramProxyWidget::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: diagramproxywidget.cpp:328
DiagramProxyWidget::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:261
DiagramProxyWidget::m_widget
UMLWidget * m_widget
Definition: diagramproxywidget.h:75
DiagramProxyWidget::slotMenuSelection
void slotMenuSelection(QAction *action)
Definition: diagramproxywidget.cpp:355
DiagramProxyWidget::loadFromXMI1
bool loadFromXMI1(QDomElement &qElement)
Definition: diagramproxywidget.cpp:107
DiagramProxyWidget::operator=
DiagramProxyWidget & operator=(const DiagramProxyWidget &other)
Definition: diagramproxywidget.cpp:168
DiagramProxyWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:228
DiagramProxyWidget::saveToXMI1
void saveToXMI1(QXmlStreamWriter &writer)
Definition: diagramproxywidget.cpp:114
DiagramProxyWidget::setupEvent
void setupEvent(QGraphicsSceneMouseEvent &e, QGraphicsSceneMouseEvent *event, const QPointF &pos)
Definition: diagramproxywidget.cpp:185
DiagramProxyWidget::mapToClient
QPointF mapToClient(const QPointF &pos)
Definition: diagramproxywidget.cpp:158
DiagramProxyWidget::m_diagramLinkId
Uml::ID::Type m_diagramLinkId
id of linked diagram
Definition: diagramproxywidget.h:70
DiagramProxyWidget::linkedDiagram
UMLScene * linkedDiagram() const
Definition: diagramproxywidget.cpp:46
DiagramProxyWidget::m_linkedDiagram
QPointer< UMLScene > m_linkedDiagram
pointer to linked diagram
Definition: diagramproxywidget.h:71
DiagramProxyWidget::setShowLinkedDiagram
void setShowLinkedDiagram(bool showLinkedDiagram)
Definition: diagramproxywidget.cpp:316
DiagramProxyWidget::DiagramProxyWidget
DiagramProxyWidget(UMLWidget *widget, qreal borderWidth=5)
Definition: diagramproxywidget.cpp:32
DiagramProxyWidget::setDiagramLink
bool setDiagramLink(const Uml::ID::Type &id)
Definition: diagramproxywidget.cpp:51
DiagramProxyWidget::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:249
DiagramProxyWidget::m_clientRect
QRectF m_clientRect
widget area for embedded diagram
Definition: diagramproxywidget.h:72
DiagramProxyWidget::~DiagramProxyWidget
virtual ~DiagramProxyWidget()
Definition: diagramproxywidget.h:33
DiagramProxyWidget::m_sceneRect
QRectF m_sceneRect
scene rectangle used for internal calculations
Definition: diagramproxywidget.h:73
IDChangeLog
Definition: idchangelog.h:27
UMLScene
Definition: umlscene.h:70
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:41
Uml::ID::Type
std::string Type
Definition: basictypes.h:385