Menu

[c54480]: / floatobj.cpp  Maximize  Restore  History

Download this file

111 lines (91 with data), 2.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
#include <QDebug>
#include "floatobj.h"
#include "mapitem.h"
extern bool debug;
/////////////////////////////////////////////////////////////////
// FloatObj
/////////////////////////////////////////////////////////////////
FloatObj::FloatObj (QGraphicsItem *parent, TreeItem *ti):OrnamentedObj(parent,ti)
{
//qDebug() << "Const FloatObj s="<<s<<" ti="<<ti<<" treeItem="<<treeItem;
init();
}
FloatObj::~FloatObj ()
{
// qDebug() << "Destr FloatObj";
}
void FloatObj::init ()
{
setLinkStyle (LinkableMapObj::Parabel);
((MapItem*)treeItem)->setHideLinkUnselected(true);
}
void FloatObj::copy (FloatObj* other)
{
LinkableMapObj::copy (other);
setVisibility (other->visible);
}
void FloatObj::move (double x, double y)
{
MapObj::move(x,y);
}
void FloatObj::move (QPointF p)
{
FloatObj::move(p.x(), p.y());
}
void FloatObj::moveCenter (double x, double y)
{
absPos=QPointF(x,y);
bbox.moveTo(x - bbox.width()/2, y - bbox.height()/2 );
clickPoly=QPolygonF (bbox);
}
void FloatObj::moveCenter2RelPos(double x, double y)
{
setRelPos (QPointF(x,y));
if (parObj)
{
QPointF p=parObj->getFloatRefPos();
moveCenter (p.x() + x, p.y() + y);
}
}
void FloatObj::move2RelPos(double x, double y) // overloaded to use floatRefPos instead of childRefPos
{
setRelPos (QPointF(x,y));
if (parObj)
{
QPointF p=parObj->getFloatRefPos();
move (p.x() + x, p.y() + y);
}
}
void FloatObj::move2RelPos(QPointF p) // overloaded to use floatRefPos instead of childRefPos
{
move2RelPos (p.x(), p.y());
}
void FloatObj::setRelPos()
{
if (parObj)
setRelPos (absPos - parObj->getFloatRefPos() );
else
qWarning()<<"FO::setRelPos parObj==0 this="<<this;
}
void FloatObj::setRelPos(const QPointF &p)
{
if (parObj)
{
relPos=p;
useRelPos=true;
} else
qWarning()<<"LMO::setRelPos (p) parObj==0 this="<<this;
}
void FloatObj::setDockPos()
{
parPos=absPos;
}
void FloatObj::reposition()
{
moveCenter2RelPos (relPos.x(), relPos.y());
updateLinkGeometry();
}
QRectF FloatObj::getBBoxSizeWithChildren()
{
return bboxTotal;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.