12
12
#include "pinwidget.h"
15
#include <QtGui/QPainter>
19
#include <kinputdialog.h>
22
15
#include "debug_utils.h"
25
#include "docwindow.h"
16
#include "floatingtextwidget.h"
17
#include "listpopupmenu.h"
26
18
#include "umlscene.h"
27
19
#include "uniqueid.h"
28
#include "listpopupmenu.h"
29
#include "floatingtextwidget.h"
22
#include <kinputdialog.h>
32
26
#include <QMouseEvent>
35
PinWidget::PinWidget(UMLScene * scene, UMLWidget* a, Uml::IDType id)
36
: UMLWidget(scene, WidgetBase::wt_Pin, id)
34
* Creates a Pin widget.
36
* @param scene The parent of the widget.
37
* @param a The widget to which this pin is attached.
38
* @param id The ID to assign (-1 will prompt a new ID).
40
PinWidget::PinWidget(UMLScene* scene, UMLWidget* a, Uml::IDType id)
41
: UMLWidget(scene, WidgetBase::wt_Pin, id),
44
m_ignoreSnapToGrid = true;
45
m_ignoreSnapComponentSizeToGrid = true;
39
47
setMinimumSize(10,10);
40
48
setMaximumSize(10,10);
43
50
m_nY = y() < getMinY() ? getMinY() : y();
45
52
m_pName = new FloatingTextWidget(scene, Uml::TextRole::Floating, "");
46
53
scene->setupNewWidget(m_pName);
52
64
PinWidget::~PinWidget()
56
void PinWidget::init()
58
m_ignoreSnapToGrid = true;
59
m_ignoreSnapComponentSizeToGrid = true;
69
* Overrides the standard paint event.
66
71
void PinWidget::paint(QPainter & p, int offsetX, int offsetY)
187
void PinWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement )
207
* Saves the widget to the "pinwidget" XMI element.
209
void PinWidget::saveToXMI(QDomDocument& qDoc, QDomElement& qElement)
189
211
QDomElement PinElement = qDoc.createElement( "pinwidget" );
190
212
PinElement.setAttribute( "widgetaid", ID2STR(m_pOw->id()) );
196
218
qElement.appendChild( PinElement );
200
bool PinWidget::loadFromXMI( QDomElement & qElement )
222
* Loads the widget from the "pinwidget" XMI element.
224
bool PinWidget::loadFromXMI(QDomElement& qElement)
202
226
if( !UMLWidget::loadFromXMI( qElement ) )
228
252
textId = UniqueID::gen();
231
//now load child elements
255
//now load child elements
232
256
QDomNode node = qElement.firstChild();
233
257
QDomElement element = node.toElement();
234
258
if ( !element.isNull() ) {