Menu

[c54480]: / floatimageobj.cpp  Maximize  Restore  History

Download this file

126 lines (103 with data), 2.6 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include <QDebug>
#include <QImageReader>
#include "floatimageobj.h"
#include "branchobj.h"
/////////////////////////////////////////////////////////////////
// FloatImageObj
/////////////////////////////////////////////////////////////////
FloatImageObj::FloatImageObj (QGraphicsItem * parent,TreeItem *ti):FloatObj(parent,ti)
{
//qDebug() << "Const FloatImageObj this="<<this<<" ti="<<ti;
icon=new ImageObj (parent);
icon->setPos (absPos.x(), absPos.y() );
icon->setVisibility (true);
clickPoly=bbox;
useRelPos=true;
//Hide flags
systemFlags->setShowFlags(false);
// setLinkStyle (LinkableMapObj::Parabel);
}
FloatImageObj::~FloatImageObj ()
{
// qDebug() << "Destr FloatImageObj "<<this<<"";
delete(icon);
}
void FloatImageObj::copy (FloatImageObj* other)
{
FloatObj::copy (other);
icon->copy (other->icon);
positionBBox();
}
void FloatImageObj::setZValue (const int &i)
{
// qDebug()<<"FIO::setZValue z="<<i;
// qDebug()<<" icon="<<icon;
// qDebug()<<" this="<<this;
icon->setZValue (i);
}
int FloatImageObj::z ()
{
return qRound (icon->zValue());
}
void FloatImageObj::load (const QImage &img)
{
icon->load(QPixmap::fromImage(img));
if (!icon->parentItem() ) icon->setParentItem(this); // Add to scene initially
bbox.setSize ( QSizeF(
icon->boundingRect().width(),
icon->boundingRect().height()));
clickPoly=bbox;
positionBBox();
}
void FloatImageObj::setParObj (QGraphicsItem *p)
{
setParentItem (p);
icon->setParentItem (p);
parObj=(LinkableMapObj*)p;
/*
qDebug()<<"FIO::setParentItem";
qDebug()<<" this="<<this;
qDebug()<<" icon="<<icon;
*/
}
void FloatImageObj::setVisibility(bool v)
{
OrnamentedObj::setVisibility(v);
if (v)
icon->setVisibility(true);
else
icon->setVisibility(false);
}
void FloatImageObj::moveCenter (double x, double y)
{
FloatObj::moveCenter(x, y);
icon->setPos(bbox.topLeft() );
}
void FloatImageObj::move (double x, double y)
{
FloatObj::move(x,y);
icon->setPos (x,y);
positionBBox();
}
void FloatImageObj::move (QPointF p)
{
FloatImageObj::move (p.x(),p.y());
}
void FloatImageObj::positionBBox()
{
clickPoly=QPolygonF(bbox);
setZValue (dZ_FLOATIMG);
}
void FloatImageObj::calcBBoxSize()
{
// TODO
}
QRectF FloatImageObj::getBBoxSizeWithChildren()
{
//TODO abstract in linkablemapobj.h, not calculated
return bboxTotal;
}
void FloatImageObj::calcBBoxSizeWithChildren()
{
//TODO abstract in linkablemapobj.h
}
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.