umbrello: umbrello/umlwidgets/widget_utils.h Source File

umbrello 2.32.0 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 class QXmlStreamWriter;
28
33 namespace Widget_Utils
34 {
35 UMLWidget* findWidget(Uml::ID::Type id,
36 const UMLWidgetList& widgets,
37 const MessageWidgetList* messages = 0);
38
39 QGraphicsRectItem* decoratePoint(const QPointF& p, QGraphicsItem* parent = 0);
40
41 void drawCrossInEllipse(QPainter *p, const QRectF& ellipse);
42 void drawTriangledRect(QPainter *painter, const QRectF& rect, const QSizeF& triSize);
43 // void drawArrowHead(QPainter *painter, const QPointF& arrowPos,
44 // const QSizeF& arrowSize, Qt::ArrowType arrowType,
45 // bool solid = false);
46 // void drawRoundedRect(QPainter *painter, const QRectF& rect, qreal xRadius,
47 // qreal yRadius, Uml::Corners corners);
48
49 QString pointToString(const QPointF& point);
50 QPointF stringToPoint(const QString& str);
51
52 bool loadPixmapFromXMI(QDomElement &qElement, QPixmap &pixmap);
53 void savePixmapToXMI(QXmlStreamWriter& stream, const QPixmap& pixmap);
54
55 bool loadGradientFromXMI(QDomElement &qElement, QGradient *&gradient);
56 void saveGradientToXMI(QXmlStreamWriter& stream, const QGradient *gradient);
57
58 bool loadBrushFromXMI(QDomElement &qElement, QBrush &brush);
59 void saveBrushToXMI(QXmlStreamWriter& stream, 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
basictypes.h
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:41
WidgetBase::WidgetType
WidgetType
Definition: widgetbase.h:112
messagewidgetlist.h
MessageWidgetList
QList< QPointer< MessageWidget > > MessageWidgetList
Definition: messagewidgetlist.h:18
Uml::ID::Type
std::string Type
Definition: basictypes.h:385
Widget_Utils
Definition: widget_utils.cpp:34
Widget_Utils::saveBrushToXMI
void saveBrushToXMI(QXmlStreamWriter &stream, const QBrush &brush)
Definition: widget_utils.cpp:512
Widget_Utils::newTitle
QString newTitle(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:881
Widget_Utils::loadPixmapFromXMI
bool loadPixmapFromXMI(QDomElement &pixEle, QPixmap &pixmap)
Definition: widget_utils.cpp:275
Widget_Utils::defaultWidgetName
QString defaultWidgetName(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:834
Widget_Utils::stringToPoint
QPointF stringToPoint(const QString &str)
Definition: widget_utils.cpp:254
Widget_Utils::pointToString
QString pointToString(const QPointF &point)
Definition: widget_utils.cpp:246
Widget_Utils::decoratePoint
QGraphicsRectItem * decoratePoint(const QPointF &p, QGraphicsItem *parent)
Definition: widget_utils.cpp:72
Widget_Utils::findWidget
UMLWidget * findWidget(Uml::ID::Type id, const UMLWidgetList &widgets, const MessageWidgetList *messages)
Definition: widget_utils.cpp:44
Widget_Utils::savePixmapToXMI
void savePixmapToXMI(QXmlStreamWriter &stream, const QPixmap &pixmap)
Definition: widget_utils.cpp:306
Widget_Utils::saveGradientToXMI
void saveGradientToXMI(QXmlStreamWriter &stream, const QGradient *gradient)
Definition: widget_utils.cpp:408
Widget_Utils::drawCrossInEllipse
void drawCrossInEllipse(QPainter *p, const QRectF &r)
Definition: widget_utils.cpp:90
Widget_Utils::closestPoints
QLineF closestPoints(const QPolygonF &self, const QPolygonF &other)
Definition: widget_utils.cpp:690
Widget_Utils::newText
QString newText(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:927
Widget_Utils::loadGradientFromXMI
bool loadGradientFromXMI(QDomElement &gradientElement, QGradient *&gradient)
Definition: widget_utils.cpp:337
Widget_Utils::loadBrushFromXMI
bool loadBrushFromXMI(QDomElement &qElement, QBrush &brush)
Definition: widget_utils.cpp:458
Widget_Utils::renameText
QString renameText(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:1019
Widget_Utils::renameTitle
QString renameTitle(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:973
Widget_Utils::drawTriangledRect
void drawTriangledRect(QPainter *painter, const QRectF &rect, const QSizeF &triSize)
Definition: widget_utils.cpp:131
Widget_Utils::hasSmallerX
bool hasSmallerX(const UMLWidget *widget1, const UMLWidget *widget2)
Definition: widget_utils.cpp:538
Widget_Utils::hasSmallerY
bool hasSmallerY(const UMLWidget *widget1, const UMLWidget *widget2)
Definition: widget_utils.cpp:549
umlwidgetlist.h
UMLWidgetList
QList< QPointer< UMLWidget > > UMLWidgetList
Definition: umlwidgetlist.h:17
widgetbase.h