umbrello: umbrello/umlwidgets/diagramproxywidget.h Source File

umbrello 2.31.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
29 class DiagramProxyWidget {
30 public:
31 DiagramProxyWidget(UMLWidget *widget, qreal borderWidth = 5);
32 virtual ~DiagramProxyWidget() {}
33 Uml::ID::Type diagramLink() const;
34 UMLScene *linkedDiagram() const;
35 bool setDiagramLink(const Uml::ID::Type &id);
36 const QRectF &clientRect();
37 const QRectF &sceneRect();
38 void setClientRect(const QRectF &rect);
39
40 bool isProxyWidget();
41 UMLWidget *getProxiedWidget(const QPointF &p);
42 QPointF mapFromClient(const QPointF &p);
43 QRectF mapFromClient(const QRectF &r);
44 QPointF mapToClient(const QPointF &pos);
45
46 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
47
48 bool showLinkedDiagram() const;
49 void setShowLinkedDiagram(bool showLinkedDiagram);
50
51 QRectF iconRect() const;
52 void setIconRect(const QRectF &iconRect);
53
54 protected:
55 DiagramProxyWidget& operator=(const DiagramProxyWidget& other);
56 bool activate(IDChangeLog* changeLog = 0);
57 bool loadFromXMI1(QDomElement &qElement);
58 void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement);
59 void setupEvent(QGraphicsSceneMouseEvent &e, QGraphicsSceneMouseEvent *event, const QPointF &pos);
60 void setupEvent(QGraphicsSceneContextMenuEvent &e, QGraphicsSceneContextMenuEvent *event, const QPointF &pos);
61 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
62 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
63 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
64 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
65 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
66 void slotMenuSelection(QAction *action);
67
68 private:
69 Uml::ID::Type m_diagramLinkId;
70 QPointer<UMLScene> m_linkedDiagram;
71 QRectF m_clientRect;
72 QRectF m_sceneRect;
73 QRectF m_iconRect;
74 UMLWidget *m_widget;
75 qreal m_borderWidth;
76 bool m_showLinkedDiagram;
77 };
78
79 #endif // DIAGRAMPROXYWIDGET_H
DiagramProxyWidget::setClientRect
void setClientRect(const QRectF &rect)
Definition: diagramproxywidget.cpp:90
cmdcreatediagram.h
SelectDiagramDialog::currentID
Uml::ID::Type currentID()
Definition: selectdiagramdialog.cpp:33
DiagramProxyWidget::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:260
DiagramProxyWidget::m_diagramLinkId
Uml::ID::Type m_diagramLinkId
id of linked diagram
Definition: diagramproxywidget.h:69
statewidget.h
umlview.h
Uml::CmdCreateDiagram
Definition: cmdcreatediagram.h:24
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:40
DiagramProxyWidget::~DiagramProxyWidget
virtual ~DiagramProxyWidget()
Definition: diagramproxywidget.h:32
Tracer::instance
static Tracer * instance()
Definition: debug_utils.cpp:36
ListPopupMenu::mt_EditCombinedState
@ mt_EditCombinedState
Definition: listpopupmenu.h:79
DiagramProxyWidget::contextMenuEvent
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition: diagramproxywidget.cpp:215
DiagramProxyWidget::clientRect
const QRectF & clientRect()
Definition: diagramproxywidget.cpp:70
diagramproxywidget.h
DEBUG_REGISTER_DISABLED
#define DEBUG_REGISTER_DISABLED(src)
Definition: debug_utils.h:132
selectdiagramdialog.h
Uml::DiagramType::State
@ State
Definition: basictypes.h:102
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:370
WidgetBase::asStateWidget
StateWidget * asStateWidget()
Definition: widgetbase.cpp:1492
DiagramProxyWidget::setShowLinkedDiagram
void setShowLinkedDiagram(bool showLinkedDiagram)
Definition: diagramproxywidget.cpp:315
Uml::ID::toString
QString toString(const ID::Type &id)
Definition: basictypes.cpp:1280
Dialog_Utils::askNewName
bool askNewName(WidgetBase::WidgetType type, QString &name)
Definition: dialog_utils.cpp:150
Uml::ID::Type
std::string Type
Definition: basictypes.h:368
DiagramProxyWidget::showLinkedDiagram
bool showLinkedDiagram() const
Definition: diagramproxywidget.cpp:306
DiagramProxyWidget::m_clientRect
QRectF m_clientRect
widget area for embedded diagram
Definition: diagramproxywidget.h:71
ListPopupMenu::mt_RemoveStateDiagram
@ mt_RemoveStateDiagram
Definition: listpopupmenu.h:142
DiagramProxyWidget::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:248
DiagramProxyWidget::mapFromClient
QPointF mapFromClient(const QPointF &p)
Definition: diagramproxywidget.cpp:136
Widget_Utils::defaultWidgetName
QString defaultWidgetName(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:842
DiagramProxyWidget::sceneRect
const QRectF & sceneRect()
Definition: diagramproxywidget.cpp:80
diagram_utils.h
StateWidget::setStateType
void setStateType(StateType stateType)
Definition: statewidget.cpp:409
UMLDoc::createDiagramName
QString createDiagramName(Uml::DiagramType::Enum type, bool askForName=true)
Definition: umldoc.cpp:1617
DiagramProxyWidget
Definition: diagramproxywidget.h:29
DiagramProxyWidget::setupEvent
void setupEvent(QGraphicsSceneMouseEvent &e, QGraphicsSceneMouseEvent *event, const QPointF &pos)
Definition: diagramproxywidget.cpp:184
DiagramProxyWidget::setDiagramLink
bool setDiagramLink(const Uml::ID::Type &id)
Definition: diagramproxywidget.cpp:48
DiagramProxyWidget::activate
bool activate(IDChangeLog *changeLog=0)
Definition: diagramproxywidget.cpp:95
Uml::ID::fromString
ID::Type fromString(const QString &id)
Definition: basictypes.cpp:1285
IDChangeLog
Definition: idchangelog.h:26
UMLDoc::changeCurrentView
void changeCurrentView(Uml::ID::Type id)
Definition: umldoc.cpp:1774
Uml::CmdCreateDiagram::view
UMLView * view()
Definition: cmdcreatediagram.h:32
DiagramProxyWidget::setIconRect
void setIconRect(const QRectF &iconRect)
Definition: diagramproxywidget.cpp:297
UMLView
Definition: umlview.h:34
ListPopupMenu::mt_CombinedState
@ mt_CombinedState
Definition: listpopupmenu.h:74
DiagramProxyWidget::mapToClient
QPointF mapToClient(const QPointF &pos)
Definition: diagramproxywidget.cpp:157
umlwidget.h
DiagramProxyWidget::DiagramProxyWidget
DiagramProxyWidget(UMLWidget *widget, qreal borderWidth=5)
Definition: diagramproxywidget.cpp:29
UMLScene::setWidgetLink
void setWidgetLink(WidgetBase *w)
Definition: umlscene.cpp:4387
ListPopupMenu::mt_SelectStateDiagram
@ mt_SelectStateDiagram
Definition: listpopupmenu.h:121
DiagramProxyWidget::diagramLink
Uml::ID::Type diagramLink() const
Definition: diagramproxywidget.cpp:38
ListPopupMenu::mt_State_Diagram
@ mt_State_Diagram
Definition: listpopupmenu.h:54
basictypes.h
DiagramProxyWidget::isProxyWidget
bool isProxyWidget()
Definition: diagramproxywidget.cpp:119
StateWidget::Combined
@ Combined
Definition: statewidget.h:58
DiagramProxyWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:227
DiagramProxyWidget::m_borderWidth
qreal m_borderWidth
Definition: diagramproxywidget.h:75
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:269
widget_utils.h
DiagramProxyWidget::loadFromXMI1
bool loadFromXMI1(QDomElement &qElement)
Definition: diagramproxywidget.cpp:104
DiagramProxyWidget::m_showLinkedDiagram
bool m_showLinkedDiagram
Definition: diagramproxywidget.h:76
WidgetBase
Common base class for UMLWidget and AssociationWidget.
Definition: widgetbase.h:104
DiagramProxyWidget::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition: diagramproxywidget.cpp:272
DiagramProxyWidget::getProxiedWidget
UMLWidget * getProxiedWidget(const QPointF &p)
Definition: diagramproxywidget.cpp:124
Uml
Definition: basictypes.cpp:36
SelectDiagramDialog
Definition: selectdiagramdialog.h:25
DiagramProxyWidget::m_iconRect
QRectF m_iconRect
widget area for diagram icon
Definition: diagramproxywidget.h:73
DiagramProxyWidget::m_widget
UMLWidget * m_widget
Definition: diagramproxywidget.h:74
DiagramProxyWidget::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: diagramproxywidget.cpp:327
uError
#define uError()
Definition: debug_utils.h:123
Diagram_Utils::isUniqueDiagramName
bool isUniqueDiagramName(Uml::DiagramType::Enum type, QString &name)
Definition: diagram_utils.cpp:522
umlscene.h
uml.h
DiagramProxyWidget::m_linkedDiagram
QPointer< UMLScene > m_linkedDiagram
pointer to linked diagram
Definition: diagramproxywidget.h:70
debug_utils.h
DiagramProxyWidget::saveToXMI1
void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: diagramproxywidget.cpp:111
UMLScene
Definition: umlscene.h:68
ListPopupMenu::typeFromAction
static MenuType typeFromAction(QAction *action)
Definition: listpopupmenu.cpp:407
Icon_Utils::smallIcon
QPixmap smallIcon(Uml::DiagramType::Enum dt)
Definition: icon_utils.cpp:162
UMLWidget::updateGeometry
void updateGeometry(bool withAssocs=true)
Definition: umlwidget.cpp:1781
UMLView::umlScene
UMLScene * umlScene() const
Definition: umlview.cpp:56
listpopupmenu.h
DiagramProxyWidget::linkedDiagram
UMLScene * linkedDiagram() const
Definition: diagramproxywidget.cpp:43
dialog_utils.h
UMLScene::ID
Uml::ID::Type ID() const
Definition: umlscene.cpp:442
UMLApp::executeCommand
void executeCommand(QUndoCommand *cmd)
Definition: uml.cpp:3416
DiagramProxyWidget::m_sceneRect
QRectF m_sceneRect
scene rectangle used for internal calculations
Definition: diagramproxywidget.h:72
DiagramProxyWidget::iconRect
QRectF iconRect() const
Definition: diagramproxywidget.cpp:288
UMLDoc::findView
UMLView * findView(Uml::ID::Type id)
Definition: umldoc.cpp:1003
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1055
umldoc.h
DiagramProxyWidget::operator=
DiagramProxyWidget & operator=(const DiagramProxyWidget &other)
Definition: diagramproxywidget.cpp:167
WidgetBase::id
Uml::ID::Type id() const
Definition: widgetbase.cpp:214
DiagramProxyWidget::slotMenuSelection
void slotMenuSelection(QAction *action)
Definition: diagramproxywidget.cpp:354
ListPopupMenu::mt_GoToStateDiagram
@ mt_GoToStateDiagram
Definition: listpopupmenu.h:91