umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Enumerations | Functions
Widget_Utils Namespace Reference

Enumerations

enum  Axis_Type { X , Y }
 
enum  Comparison_Type { Smallest , Largest }
 

Functions

UMLWidgetfindWidget (Uml::ID::Type id, const UMLWidgetList &widgets, const MessageWidgetList *messages)
 
QGraphicsRectItem * decoratePoint (const QPointF &p, QGraphicsItem *parent)
 
void drawCrossInEllipse (QPainter *p, const QRectF &r)
 
void drawTriangledRect (QPainter *painter, const QRectF &rect, const QSizeF &triSize)
 
QString pointToString (const QPointF &point)
 
QPointF stringToPoint (const QString &str)
 
bool loadPixmapFromXMI (QDomElement &pixEle, QPixmap &pixmap)
 
void savePixmapToXMI (QXmlStreamWriter &stream, const QPixmap &pixmap)
 
bool loadGradientFromXMI (QDomElement &gradientElement, QGradient *&gradient)
 
void saveGradientToXMI (QXmlStreamWriter &stream, const QGradient *gradient)
 
bool loadBrushFromXMI (QDomElement &qElement, QBrush &brush)
 
void saveBrushToXMI (QXmlStreamWriter &stream, const QBrush &brush)
 
bool hasSmallerX (const UMLWidget *widget1, const UMLWidget *widget2)
 
bool hasSmallerY (const UMLWidget *widget1, const UMLWidget *widget2)
 
Uml::Region::Enum findRegion (const QRectF &self, const QRectF &other)
 
QPointF prevPoint (int index, const QPolygonF &poly)
 
QPointF nextPoint (int index, const QPolygonF &poly)
 
qreal middle (qreal a, qreal b)
 
QLineF findLine (const QPolygonF &poly, Axis_Type axis, Comparison_Type seek, const QRectF &boundingRect)
 
QLineF closestPoints (const QPolygonF &self, const QPolygonF &other)
 
QString defaultWidgetName (WidgetBase::WidgetType type)
 
QString newTitle (WidgetBase::WidgetType type)
 
QString newText (WidgetBase::WidgetType type)
 
QString renameTitle (WidgetBase::WidgetType type)
 
QString renameText (WidgetBase::WidgetType type)
 
void ensureNestedVisible (UMLWidget *self, UMLWidgetList widgetList)
 
QString adornStereo (QString name, bool appendSpace)
 

Detailed Description

General purpose widget utilities. Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

Enumeration Type Documentation

◆ Axis_Type

Auxiliary type for function findLine()

Enumerator

◆ Comparison_Type

Auxiliary type for function findLine()

Enumerator
Smallest 
Largest 

Function Documentation

◆ adornStereo()

QString Widget_Utils::adornStereo ( QString  name,
bool  appendSpace 
)

Adorn stereotype name with guillemets.

◆ closestPoints()

QLineF Widget_Utils::closestPoints ( const QPolygonF &  self,
const QPolygonF &  other 
)

Determine the approximate closest points of two polygons.

Parameters
selfFirst QPolygonF.
otherSecond QPolygonF.
Returns
QLineF::p1() returns point of self; QLineF::p2() returns point of other.
Here is the call graph for this function:

◆ decoratePoint()

QGraphicsRectItem * Widget_Utils::decoratePoint ( const QPointF &  p,
QGraphicsItem *  parent 
)

Creates the decoration point.

Parameters
pbase point to decorate
parentparent item
Returns
decoration point

◆ defaultWidgetName()

QString Widget_Utils::defaultWidgetName ( WidgetBase::WidgetType  type)

Returns a default name for the new widget

Parameters
typethe widget type
Returns
the default name
Here is the call graph for this function:

◆ drawCrossInEllipse()

void Widget_Utils::drawCrossInEllipse ( QPainter *  p,
const QRectF &  r 
)

Calculates and draws a cross inside an ellipse

Parameters
pPointer to a QPainter object.
rThe rectangle describing the ellipse.

◆ drawTriangledRect()

void Widget_Utils::drawTriangledRect ( QPainter *  painter,
const QRectF &  rect,
const QSizeF &  triSize 
)

Draws a polygon which is almost rectangular except for the top right corner. A triangle is drawn in top right corner of the rectangle.

Parameters
painterThe painter with which this shape is to be drawn.
rectThe rectangle dimensions.
triSizeThe size of the triangle in the top-right corner.

◆ ensureNestedVisible()

void Widget_Utils::ensureNestedVisible ( UMLWidget self,
UMLWidgetList  widgetList 
)

Prevent nested widget(s) located inside the area of a larger widget from disappearing.

Parameters
selfThe widget against which to test the other widgets of the diagram
widgetListThe widgets of the diagram
Here is the call graph for this function:

◆ findLine()

QLineF Widget_Utils::findLine ( const QPolygonF &  poly,
Axis_Type  axis,
Comparison_Type  seek,
const QRectF &  boundingRect 
)

Find the line of poly with the smallest or largest value (controlled by seek) along the axis controlled by axis. In case axis is X, do not consider lines whose Y values lie outside the Y values defined by boundingRect. In case axis is Y, do not consider lines whose X values lie outside the X values defined by boundingRect.

◆ findRegion()

Uml::Region::Enum Widget_Utils::findRegion ( const QRectF &  self,
const QRectF &  other 
)

Find the region in which the rectangle other lies with respect to the rectangle self. Beware that the Qt coordinate system has its origin point (0,0) in the upper left corner with Y values growing downwards, thus the Y related comparisons might look inverted if your are used to the natural coordinate system with (0,0) in the lower left corner.

◆ findWidget()

UMLWidget * Widget_Utils::findWidget ( Uml::ID::Type  id,
const UMLWidgetList widgets,
const MessageWidgetList messages 
)

Find the widget identified by the given ID in the given widget or message list.

Parameters
idThe unique ID to find.
widgetsThe UMLWidgetList to search in.
messagesOptional pointer to a MessageWidgetList to search in.
Here is the call graph for this function:

◆ hasSmallerX()

bool Widget_Utils::hasSmallerX ( const UMLWidget widget1,
const UMLWidget widget2 
)

Returns true if the first widget's X is smaller than second's. Used for sorting the UMLWidgetList.

Parameters
widget1The widget to compare.
widget2The widget to compare with.

◆ hasSmallerY()

bool Widget_Utils::hasSmallerY ( const UMLWidget widget1,
const UMLWidget widget2 
)

Returns true if the first widget's Y is smaller than second's. Used for sorting the UMLWidgetList.

Parameters
widget1The widget to compare.
widget2The widget to compare with.

◆ loadBrushFromXMI()

bool Widget_Utils::loadBrushFromXMI ( QDomElement &  qElement,
QBrush &  brush 
)

Extracts the QBrush properties into brush from the XMI xml element qElement.

Parameters
qElementThe DOM element from which the xmi info should be extracted.
brushThe QBrush object into which brush details should be read into.
Here is the call graph for this function:

◆ loadGradientFromXMI()

bool Widget_Utils::loadGradientFromXMI ( QDomElement &  gradientElement,
QGradient *&  gradient 
)

Loads gradient from xmi. The gradient pointer should be null and the new gradient object will be created inside this method. The gradient should later be deleted externally.

Parameters
gradientElementThe DOM element from which gradient should be loaded.
gradientThe pointer to gradient into which the gradient should be loaded. (Allocated inside this method)
Returns
True or false based on success or failure of this method.
Here is the call graph for this function:

◆ loadPixmapFromXMI()

bool Widget_Utils::loadPixmapFromXMI ( QDomElement &  pixEle,
QPixmap &  pixmap 
)

Loads pixmap from xmi.

Parameters
pixEleThe dom element from which pixmap should be loaded.
pixmapThe pixmap into which the image should be loaded.
Returns
True or false based on success or failure of this method.

◆ middle()

qreal Widget_Utils::middle ( qreal  a,
qreal  b 
)

Return the middle value between a and b.

◆ newText()

QString Widget_Utils::newText ( WidgetBase::WidgetType  type)

Returns translated text string used by widget related dialogs

Parameters
typewidget type
Returns
translated text string
Here is the call graph for this function:

◆ newTitle()

QString Widget_Utils::newTitle ( WidgetBase::WidgetType  type)

Returns translated title string used by widget related dialogs

Parameters
typewidget type
Returns
translated title string
Here is the call graph for this function:

◆ nextPoint()

QPointF Widget_Utils::nextPoint ( int  index,
const QPolygonF &  poly 
)

Return the point in poly which follows the point at index index. If index is the last index then return the first (or, if poly.isClosed() is true, the second) point.

◆ pointToString()

QString Widget_Utils::pointToString ( const QPointF &  point)

Converts a point to a comma separated string i.e "x,y"

Parameters
pointThe QPointF to convert.

◆ prevPoint()

QPointF Widget_Utils::prevPoint ( int  index,
const QPolygonF &  poly 
)

Return the point in poly which precedes the point at index index. If index is 0 then return the last (or, if poly.isClosed() is true, the second to last) point.

◆ renameText()

QString Widget_Utils::renameText ( WidgetBase::WidgetType  type)

Returns translated text string used by widget related dialogs

Parameters
typewidget type
Returns
translated text string
Here is the call graph for this function:

◆ renameTitle()

QString Widget_Utils::renameTitle ( WidgetBase::WidgetType  type)

Returns translated title string used by widget related dialogs

Parameters
typewidget type
Returns
translated title string
Here is the call graph for this function:

◆ saveBrushToXMI()

void Widget_Utils::saveBrushToXMI ( QXmlStreamWriter &  stream,
const QBrush &  brush 
)

Saves the brush info as XMI.

Parameters
streamThe QXmlStreamWriter object to write to.
brushThe QBrush whose details should be saved.
Here is the call graph for this function:

◆ saveGradientToXMI()

void Widget_Utils::saveGradientToXMI ( QXmlStreamWriter &  stream,
const QGradient *  gradient 
)

Saves gradient information to XMI.

Parameters
streamThe QXmlStreamWriter object to write to.
gradientThe gradient to be saved.
Here is the call graph for this function:

◆ savePixmapToXMI()

void Widget_Utils::savePixmapToXMI ( QXmlStreamWriter &  stream,
const QPixmap &  pixmap 
)

Saves pixmap information to XMI.

Parameters
streamThe QXmlStreamWriter object to write to.
pixmapThe pixmap to be saved.

◆ stringToPoint()

QPointF Widget_Utils::stringToPoint ( const QString &  str)

Converts a comma separated string to point.