Menu

[2179ca]: / floatimageobj.cpp  Maximize  Restore  History

Download this file

105 lines (86 with data), 2.1 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
#include <QImageReader>
#include "floatimageobj.h"
#include "branchobj.h"
/////////////////////////////////////////////////////////////////
// FloatImageObj
/////////////////////////////////////////////////////////////////
FloatImageObj::FloatImageObj (QGraphicsScene* s,TreeItem *ti):FloatObj(s,ti)
{
//cout << "Const FloatImageObj s="<<s<<" ti="<<ti<<endl;
setParObj (this);
init();
}
FloatImageObj::~FloatImageObj ()
{
// cout << "Destr FloatImageObj "<<this<<"\n";
delete(icon);
}
void FloatImageObj::init ()
{
icon=new ImageObj (scene);
icon->setPos (absPos.x(), absPos.y() );
icon->setVisibility (true);
setZValue (Z_INIT);
bbox.setSize (QSizeF(icon->boundingRect().width(), icon->boundingRect().height()));
clickPoly=QPolygonF (bbox);
useRelPos=true;
//Hide flags
systemFlags->setShowFlags(false);
}
void FloatImageObj::copy (FloatImageObj* other)
{
FloatObj::copy (other);
icon->copy (other->icon);
positionBBox();
}
void FloatImageObj::setZValue (const int &i)
{
icon->setZValue (i);
zPlane=i;
}
int FloatImageObj::z ()
{
return qRound (icon->zValue());
}
void FloatImageObj::load (const QImage &img)
{
icon->load(QPixmap::fromImage(img));
bbox.setSize (QSizeF(icon->boundingRect().width()+8, icon->boundingRect().height()+8));
clickPoly=QPolygonF (bbox);
positionBBox();
}
void FloatImageObj::setVisibility(bool v)
{
OrnamentedObj::setVisibility(v);
if (v)
icon->setVisibility(true);
else
icon->setVisibility(false);
}
void FloatImageObj::move (double x, double y)
{
FloatObj::move(x,y);
icon->setPos (x+4,y+4);
positionBBox();
}
void FloatImageObj::move (QPointF p)
{
OrnamentedObj::move (p.x(),p.y());
}
void FloatImageObj::positionBBox()
{
clickPoly=QPolygonF(bbox);
}
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.