umbrello: umbrello/umlwidgets/widget_utils.h Source File

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

widget_utils.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) 2004-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef WIDGET_UTILS_H
12 #define WIDGET_UTILS_H
13
14 #include "basictypes.h"
15 #include "messagewidgetlist.h"
16 #include "umlwidgetlist.h"
17 #include "widgetbase.h"
18
19 #include <QBrush>
20 #include <QDomDocument>
21 #include <QPointF>
22 #include <QLineF>
23 #include <QPolygonF>
24
25 class QGraphicsItem;
26 class QGraphicsRectItem;
27
32 namespace Widget_Utils
33 {
34 UMLWidget* findWidget(Uml::ID::Type id,
35 const UMLWidgetList& widgets,
36 const MessageWidgetList* messages = 0);
37
38 QGraphicsRectItem* decoratePoint(const QPointF& p, QGraphicsItem* parent = 0);
39
40 void drawCrossInEllipse(QPainter *p, const QRectF& ellipse);
41 void drawTriangledRect(QPainter *painter, const QRectF& rect, const QSizeF& triSize);
42 // void drawArrowHead(QPainter *painter, const QPointF& arrowPos,
43 // const QSizeF& arrowSize, Qt::ArrowType arrowType,
44 // bool solid = false);
45 // void drawRoundedRect(QPainter *painter, const QRectF& rect, qreal xRadius,
46 // qreal yRadius, Uml::Corners corners);
47
48 QString pointToString(const QPointF& point);
49 QPointF stringToPoint(const QString& str);
50
51 bool loadPixmapFromXMI(QDomElement &qElement, QPixmap &pixmap);
52 void savePixmapToXMI(QDomDocument &qDoc, QDomElement &qElement, const QPixmap& pixmap);
53
54 bool loadGradientFromXMI(QDomElement &qElement, QGradient *&gradient);
55 void saveGradientToXMI(QDomDocument &qDoc, QDomElement &qElement, const QGradient *gradient);
56
57 bool loadBrushFromXMI(QDomElement &qElement, QBrush &brush);
58 void saveBrushToXMI(QDomDocument &qDoc, QDomElement &qElement,
59 const QBrush& brush);
60
61 bool hasSmallerX(const UMLWidget* widget1, const UMLWidget* widget2);
62 bool hasSmallerY(const UMLWidget* widget1, const UMLWidget* widget2);
63
64 QLineF closestPoints(const QPolygonF& self, const QPolygonF& other);
65
66 QString defaultWidgetName(WidgetBase::WidgetType type);
67 QString newTitle(WidgetBase::WidgetType type);
68 QString newText(WidgetBase::WidgetType type);
69 QString renameTitle(WidgetBase::WidgetType type);
70 QString renameText(WidgetBase::WidgetType type);
71 }
72
73 #endif
Widget_Utils::savePixmapToXMI
void savePixmapToXMI(QDomDocument &qDoc, QDomElement &qElement, const QPixmap &pixmap)
Definition: widget_utils.cpp:313
Widget_Utils::X
@ X
Definition: widget_utils.cpp:643
WidgetBase::wt_Association
@ wt_Association
Definition: widgetbase.h:132
Uml::Region::NorthWest
@ NorthWest
Definition: basictypes.h:333
WidgetBase::wt_Signal
@ wt_Signal
Definition: widgetbase.h:137
WidgetBase::wt_FloatingDashLine
@ wt_FloatingDashLine
Definition: widgetbase.h:136
Widget_Utils::Smallest
@ Smallest
Definition: widget_utils.cpp:648
messagewidgetlist.h
WidgetBase::wt_ObjectNode
@ wt_ObjectNode
Definition: widgetbase.h:139
Widget_Utils::drawTriangledRect
void drawTriangledRect(QPainter *painter, const QRectF &rect, const QSizeF &triSize)
Definition: widget_utils.cpp:138
WidgetBase::toString
static QString toString(WidgetType wt)
Definition: widgetbase.cpp:1215
WidgetBase::wt_Category
@ wt_Category
Definition: widgetbase.h:141
Uml::Region::SouthEast
@ SouthEast
Definition: basictypes.h:335
Uml::Region::South
@ South
Definition: basictypes.h:332
Widget_Utils::saveGradientToXMI
void saveGradientToXMI(QDomDocument &qDoc, QDomElement &qElement, const QGradient *gradient)
Definition: widget_utils.cpp:415
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:41
WidgetBase::wt_UMLWidget
@ wt_UMLWidget
Definition: widgetbase.h:113
WidgetBase::wt_Precondition
@ wt_Precondition
Definition: widgetbase.h:134
WidgetBase::wt_Package
@ wt_Package
Definition: widgetbase.h:121
WidgetBase::wt_Instance
@ wt_Instance
Definition: widgetbase.h:143
WidgetBase::localID
Uml::ID::Type localID() const
Definition: widgetbase.cpp:238
Widget_Utils::saveBrushToXMI
void saveBrushToXMI(QDomDocument &qDoc, QDomElement &qElement, const QBrush &brush)
Definition: widget_utils.cpp:519
Widget_Utils::loadGradientFromXMI
bool loadGradientFromXMI(QDomElement &gradientElement, QGradient *&gradient)
Definition: widget_utils.cpp:344
Widget_Utils::loadPixmapFromXMI
bool loadPixmapFromXMI(QDomElement &pixEle, QPixmap &pixmap)
Definition: widget_utils.cpp:282
Widget_Utils::pointToString
QString pointToString(const QPointF &point)
Definition: widget_utils.cpp:253
Widget_Utils
Definition: widget_utils.cpp:33
WidgetBase::wt_Artifact
@ wt_Artifact
Definition: widgetbase.h:130
Uml::Region::East
@ East
Definition: basictypes.h:331
umlwidgetlist.h
Widget_Utils::hasSmallerY
bool hasSmallerY(const UMLWidget *widget1, const UMLWidget *widget2)
Definition: widget_utils.cpp:557
Uml::ID::Type
std::string Type
Definition: basictypes.h:368
WidgetBase::wt_UseCase
@ wt_UseCase
Definition: widgetbase.h:115
WidgetBase::wt_Box
@ wt_Box
Definition: widgetbase.h:124
Widget_Utils::prevPoint
QPointF prevPoint(int index, const QPolygonF &poly)
Definition: widget_utils.cpp:611
Widget_Utils::defaultWidgetName
QString defaultWidgetName(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:842
WidgetBase::wt_Component
@ wt_Component
Definition: widgetbase.h:129
Widget_Utils::nextPoint
QPointF nextPoint(int index, const QPolygonF &poly)
Definition: widget_utils.cpp:624
WidgetBase::wt_ForkJoin
@ wt_ForkJoin
Definition: widgetbase.h:133
WidgetBase::wt_Note
@ wt_Note
Definition: widgetbase.h:123
WidgetBase::isObjectWidget
bool isObjectWidget()
Definition: widgetbase.h:260
WidgetBase::wt_Actor
@ wt_Actor
Definition: widgetbase.h:114
Widget_Utils::drawCrossInEllipse
void drawCrossInEllipse(QPainter *p, const QRectF &r)
Definition: widget_utils.cpp:97
Widget_Utils::renameText
QString renameText(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:1027
WidgetBase::wt_Pin
@ wt_Pin
Definition: widgetbase.h:138
MessageWidgetList
QList< QPointer< MessageWidget > > MessageWidgetList
Definition: messagewidgetlist.h:18
Widget_Utils::renameTitle
QString renameTitle(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:981
Uml::Region::Center
@ Center
Definition: basictypes.h:337
WidgetBase::wt_Port
@ wt_Port
Definition: widgetbase.h:142
objectwidget.h
a
QString a
Definition: petalnode.cpp:18
umlwidget.h
uWarning
#define uWarning()
Definition: debug_utils.h:124
Widget_Utils::middle
qreal middle(qreal a, qreal b)
Definition: widget_utils.cpp:635
Uml::Region::NorthEast
@ NorthEast
Definition: basictypes.h:334
i18n
#define i18n
Definition: main.cpp:39
messagewidget.h
Widget_Utils::loadBrushFromXMI
bool loadBrushFromXMI(QDomElement &qElement, QBrush &brush)
Definition: widget_utils.cpp:465
WidgetBase::wt_Class
@ wt_Class
Definition: widgetbase.h:116
WidgetBase::wt_Text
@ wt_Text
Definition: widgetbase.h:126
basictypes.h
Uml::Region::West
@ West
Definition: basictypes.h:329
Uml::Region::Enum
Enum
Definition: basictypes.h:327
int
int int y int
Definition: cxx11-lambda-functions-and-expressions.h:4
UMLWidgetList
QList< QPointer< UMLWidget > > UMLWidgetList
Definition: umlwidgetlist.h:17
WidgetBase::wt_Region
@ wt_Region
Definition: widgetbase.h:140
Uml::Region::North
@ North
Definition: basictypes.h:330
WidgetBase::wt_CombinedFragment
@ wt_CombinedFragment
Definition: widgetbase.h:135
Widget_Utils::findLine
QLineF findLine(const QPolygonF &poly, Axis_Type axis, Comparison_Type seek, const QRectF &boundingRect)
Definition: widget_utils.cpp:658
Widget_Utils::Largest
@ Largest
Definition: widget_utils.cpp:648
widget_utils.h
Widget_Utils::Comparison_Type
Comparison_Type
Definition: widget_utils.cpp:648
WidgetBase::wt_Message
@ wt_Message
Definition: widgetbase.h:125
Widget_Utils::newTitle
QString newTitle(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:889
Widget_Utils::findWidget
UMLWidget * findWidget(Uml::ID::Type id, const UMLWidgetList &widgets, const MessageWidgetList *messages)
Definition: widget_utils.cpp:51
widgetbase.h
WidgetBase::wt_State
@ wt_State
Definition: widgetbase.h:127
WidgetBase::wt_Interface
@ wt_Interface
Definition: widgetbase.h:117
Widget_Utils::newText
QString newText(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:935
debug_utils.h
WidgetBase::wt_Object
@ wt_Object
Definition: widgetbase.h:122
WidgetBase::wt_Entity
@ wt_Entity
Definition: widgetbase.h:120
WidgetBase::WidgetType
WidgetType
Definition: widgetbase.h:111
WidgetBase::wt_Datatype
@ wt_Datatype
Definition: widgetbase.h:118
Widget_Utils::findRegion
Uml::Region::Enum findRegion(const QRectF &self, const QRectF &other)
Definition: widget_utils.cpp:570
WidgetBase::wt_Activity
@ wt_Activity
Definition: widgetbase.h:128
b
bool b
Definition: cxx11-null-pointer-constant.h:6
Widget_Utils::hasSmallerX
bool hasSmallerX(const UMLWidget *widget1, const UMLWidget *widget2)
Definition: widget_utils.cpp:546
Widget_Utils::closestPoints
QLineF closestPoints(const QPolygonF &self, const QPolygonF &other)
Definition: widget_utils.cpp:698
Uml::Region::SouthWest
@ SouthWest
Definition: basictypes.h:336
Widget_Utils::Axis_Type
Axis_Type
Definition: widget_utils.cpp:643
WidgetBase::wt_Enum
@ wt_Enum
Definition: widgetbase.h:119
Widget_Utils::stringToPoint
QPointF stringToPoint(const QString &str)
Definition: widget_utils.cpp:261
WidgetBase::wt_Node
@ wt_Node
Definition: widgetbase.h:131
WidgetBase::id
Uml::ID::Type id() const
Definition: widgetbase.cpp:214
Widget_Utils::decoratePoint
QGraphicsRectItem * decoratePoint(const QPointF &p, QGraphicsItem *parent)
Definition: widget_utils.cpp:79
Widget_Utils::Y
@ Y
Definition: widget_utils.cpp:643