umbrello: umbrello/umlwidgets/widget_utils.h Source File

umbrello 2.32.3 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-2020 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
68#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:29
Widget_Utils::saveBrushToXMI
void saveBrushToXMI(QXmlStreamWriter &stream, const QBrush &brush)
Definition: widget_utils.cpp:507
Widget_Utils::newTitle
QString newTitle(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:875
Widget_Utils::loadPixmapFromXMI
bool loadPixmapFromXMI(QDomElement &pixEle, QPixmap &pixmap)
Definition: widget_utils.cpp:270
Widget_Utils::defaultWidgetName
QString defaultWidgetName(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:829
Widget_Utils::stringToPoint
QPointF stringToPoint(const QString &str)
Definition: widget_utils.cpp:249
Widget_Utils::pointToString
QString pointToString(const QPointF &point)
Definition: widget_utils.cpp:241
Widget_Utils::decoratePoint
QGraphicsRectItem * decoratePoint(const QPointF &p, QGraphicsItem *parent)
Definition: widget_utils.cpp:67
Widget_Utils::findWidget
UMLWidget * findWidget(Uml::ID::Type id, const UMLWidgetList &widgets, const MessageWidgetList *messages)
Definition: widget_utils.cpp:39
Widget_Utils::savePixmapToXMI
void savePixmapToXMI(QXmlStreamWriter &stream, const QPixmap &pixmap)
Definition: widget_utils.cpp:301
Widget_Utils::saveGradientToXMI
void saveGradientToXMI(QXmlStreamWriter &stream, const QGradient *gradient)
Definition: widget_utils.cpp:403
Widget_Utils::drawCrossInEllipse
void drawCrossInEllipse(QPainter *p, const QRectF &r)
Definition: widget_utils.cpp:85
Widget_Utils::closestPoints
QLineF closestPoints(const QPolygonF &self, const QPolygonF &other)
Definition: widget_utils.cpp:685
Widget_Utils::newText
QString newText(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:920
Widget_Utils::loadGradientFromXMI
bool loadGradientFromXMI(QDomElement &gradientElement, QGradient *&gradient)
Definition: widget_utils.cpp:332
Widget_Utils::loadBrushFromXMI
bool loadBrushFromXMI(QDomElement &qElement, QBrush &brush)
Definition: widget_utils.cpp:453
Widget_Utils::renameText
QString renameText(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:1010
Widget_Utils::renameTitle
QString renameTitle(WidgetBase::WidgetType type)
Definition: widget_utils.cpp:965
Widget_Utils::drawTriangledRect
void drawTriangledRect(QPainter *painter, const QRectF &rect, const QSizeF &triSize)
Definition: widget_utils.cpp:126
Widget_Utils::hasSmallerX
bool hasSmallerX(const UMLWidget *widget1, const UMLWidget *widget2)
Definition: widget_utils.cpp:533
Widget_Utils::hasSmallerY
bool hasSmallerY(const UMLWidget *widget1, const UMLWidget *widget2)
Definition: widget_utils.cpp:544
umlwidgetlist.h
UMLWidgetList
QList< QPointer< UMLWidget > > UMLWidgetList
Definition: umlwidgetlist.h:13
widgetbase.h