umbrello: umbrello/umlwidgets/widget_utils.h Source File

umbrello 2.34.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 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2004-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef WIDGET_UTILS_H
7#define WIDGET_UTILS_H
8
9#include "basictypes.h"
10#include "messagewidgetlist.h"
11#include "umlwidgetlist.h"
12#include "widgetbase.h"
13
14#include <QBrush>
15#include <QDomDocument>
16#include <QPointF>
17#include <QLineF>
18#include <QPolygonF>
19
20class QGraphicsItem;
21class QGraphicsRectItem;
22class QXmlStreamWriter;
23
28namespace Widget_Utils
29{
30 UMLWidget* findWidget(Uml::ID::Type id,
31 const UMLWidgetList& widgets,
32 const MessageWidgetList* messages = 0);
33
34 QGraphicsRectItem* decoratePoint(const QPointF& p, QGraphicsItem* parent = 0);
35
36 void drawCrossInEllipse(QPainter *p, const QRectF& ellipse);
37 void drawTriangledRect(QPainter *painter, const QRectF& rect, const QSizeF& triSize);
38// void drawArrowHead(QPainter *painter, const QPointF& arrowPos,
39// const QSizeF& arrowSize, Qt::ArrowType arrowType,
40// bool solid = false);
41// void drawRoundedRect(QPainter *painter, const QRectF& rect, qreal xRadius,
42// qreal yRadius, Uml::Corners corners);
43
44 QString pointToString(const QPointF& point);
45 QPointF stringToPoint(const QString& str);
46
47 bool loadPixmapFromXMI(QDomElement &qElement, QPixmap &pixmap);
48 void savePixmapToXMI(QXmlStreamWriter& stream, const QPixmap& pixmap);
49
50 bool loadGradientFromXMI(QDomElement &qElement, QGradient *&gradient);
51 void saveGradientToXMI(QXmlStreamWriter& stream, const QGradient *gradient);
52
53 bool loadBrushFromXMI(QDomElement &qElement, QBrush &brush);
54 void saveBrushToXMI(QXmlStreamWriter& stream, const QBrush& brush);
55
56 bool hasSmallerX(const UMLWidget* widget1, const UMLWidget* widget2);
57 bool hasSmallerY(const UMLWidget* widget1, const UMLWidget* widget2);
58
59 QLineF closestPoints(const QPolygonF& self, const QPolygonF& other);
60
61 QString defaultWidgetName(WidgetBase::WidgetType type);
62 QString newTitle(WidgetBase::WidgetType type);
63 QString newText(WidgetBase::WidgetType type);
64 QString renameTitle(WidgetBase::WidgetType type);
65 QString renameText(WidgetBase::WidgetType type);
66
67 void ensureNestedVisible(UMLWidget *self, UMLWidgetList widgetList);
68
69 QString adornStereo(QString name, bool appendSpace = true);
70}
71
72#endif
basictypes.h
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:36
WidgetBase::WidgetType
WidgetType
Definition: widgetbase.h:107
messagewidgetlist.h
MessageWidgetList
QList< QPointer< MessageWidget > > MessageWidgetList
Definition: messagewidgetlist.h:13
Uml::ID::Type
std::string Type
Definition: basictypes.h:371
Widget_Utils
Definition: widget_utils.cpp:33
Widget_Utils::saveBrushToXMI
void saveBrushToXMI(QXmlStreamWriter &stream, const QBrush &brush)
Definition: widget_utils.cpp:511
Widget_Utils::newTitle
QString newTitle(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:880
Widget_Utils::loadPixmapFromXMI
bool loadPixmapFromXMI(QDomElement &pixEle, QPixmap &pixmap)
Definition: widget_utils.cpp:274
Widget_Utils::defaultWidgetName
QString defaultWidgetName(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:833
Widget_Utils::stringToPoint
QPointF stringToPoint(const QString &str)
Definition: widget_utils.cpp:253
Widget_Utils::pointToString
QString pointToString(const QPointF &point)
Definition: widget_utils.cpp:245
Widget_Utils::decoratePoint
QGraphicsRectItem * decoratePoint(const QPointF &p, QGraphicsItem *parent)
Definition: widget_utils.cpp:71
Widget_Utils::findWidget
UMLWidget * findWidget(Uml::ID::Type id, const UMLWidgetList &widgets, const MessageWidgetList *messages)
Definition: widget_utils.cpp:43
Widget_Utils::savePixmapToXMI
void savePixmapToXMI(QXmlStreamWriter &stream, const QPixmap &pixmap)
Definition: widget_utils.cpp:305
Widget_Utils::saveGradientToXMI
void saveGradientToXMI(QXmlStreamWriter &stream, const QGradient *gradient)
Definition: widget_utils.cpp:407
Widget_Utils::drawCrossInEllipse
void drawCrossInEllipse(QPainter *p, const QRectF &r)
Definition: widget_utils.cpp:89
Widget_Utils::closestPoints
QLineF closestPoints(const QPolygonF &self, const QPolygonF &other)
Definition: widget_utils.cpp:689
Widget_Utils::newText
QString newText(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:926
Widget_Utils::loadGradientFromXMI
bool loadGradientFromXMI(QDomElement &gradientElement, QGradient *&gradient)
Definition: widget_utils.cpp:336
Widget_Utils::loadBrushFromXMI
bool loadBrushFromXMI(QDomElement &qElement, QBrush &brush)
Definition: widget_utils.cpp:457
Widget_Utils::adornStereo
QString adornStereo(QString name, bool appendSpace)
Definition: widget_utils.cpp:1081
Widget_Utils::ensureNestedVisible
void ensureNestedVisible(UMLWidget *self, UMLWidgetList widgetList)
Definition: widget_utils.cpp:1063
Widget_Utils::renameText
QString renameText(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:1017
Widget_Utils::renameTitle
QString renameTitle(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:971
Widget_Utils::drawTriangledRect
void drawTriangledRect(QPainter *painter, const QRectF &rect, const QSizeF &triSize)
Definition: widget_utils.cpp:130
Widget_Utils::hasSmallerX
bool hasSmallerX(const UMLWidget *widget1, const UMLWidget *widget2)
Definition: widget_utils.cpp:537
Widget_Utils::hasSmallerY
bool hasSmallerY(const UMLWidget *widget1, const UMLWidget *widget2)
Definition: widget_utils.cpp:548
umlwidgetlist.h
UMLWidgetList
QList< QPointer< UMLWidget > > UMLWidgetList
Definition: umlwidgetlist.h:13
widgetbase.h