author | insilmaril |
Mon May 05 13:46:42 2008 +0000 (2008-05-05) | |
changeset 688 | d0086df58648 |
parent 421 | 5522d1da7e37 |
permissions | -rw-r--r-- |
insilmaril@0 | 1 |
#include "imageobj.h" |
insilmaril@408 | 2 |
#include "mapobj.h" |
insilmaril@0 | 3 |
|
insilmaril@0 | 4 |
///////////////////////////////////////////////////////////////// |
insilmaril@0 | 5 |
// ImageObj |
insilmaril@0 | 6 |
///////////////////////////////////////////////////////////////// |
insilmaril@408 | 7 |
ImageObj::ImageObj( QGraphicsScene *scene) : QGraphicsPixmapItem (NULL,scene ) |
insilmaril@0 | 8 |
{ |
insilmaril@408 | 9 |
// cout << "Const ImageObj (scene)\n"; |
insilmaril@408 | 10 |
|
insilmaril@408 | 11 |
setShapeMode (QGraphicsPixmapItem::BoundingRectShape); |
insilmaril@408 | 12 |
setZValue(Z_ICON); |
insilmaril@408 | 13 |
mapScene=scene; |
insilmaril@408 | 14 |
hide(); |
insilmaril@0 | 15 |
} |
insilmaril@0 | 16 |
|
insilmaril@0 | 17 |
ImageObj::~ImageObj() |
insilmaril@0 | 18 |
{ |
insilmaril@426 | 19 |
// cout << "Destr ImageObj\n"; |
insilmaril@0 | 20 |
} |
insilmaril@0 | 21 |
|
insilmaril@0 | 22 |
void ImageObj::copy(ImageObj* other) |
insilmaril@0 | 23 |
{ |
insilmaril@426 | 24 |
prepareGeometryChange(); |
insilmaril@0 | 25 |
setVisibility (other->isVisible() ); |
insilmaril@408 | 26 |
setPixmap (other->QGraphicsPixmapItem::pixmap()); |
insilmaril@408 | 27 |
setPos (other->pos()); |
insilmaril@0 | 28 |
} |
insilmaril@0 | 29 |
|
insilmaril@0 | 30 |
void ImageObj::setVisibility (bool v) |
insilmaril@0 | 31 |
{ |
insilmaril@0 | 32 |
if (v) |
insilmaril@0 | 33 |
show(); |
insilmaril@0 | 34 |
else |
insilmaril@0 | 35 |
hide(); |
insilmaril@0 | 36 |
} |
insilmaril@0 | 37 |
|
insilmaril@0 | 38 |
void ImageObj::save(const QString &fn, const char *format) |
insilmaril@0 | 39 |
{ |
insilmaril@421 | 40 |
pixmap().save (fn,format,100); |
insilmaril@0 | 41 |
} |
insilmaril@0 | 42 |
|
insilmaril@0 | 43 |
bool ImageObj::load (const QString &fn) |
insilmaril@0 | 44 |
{ |
insilmaril@408 | 45 |
QPixmap pixmap; |
insilmaril@408 | 46 |
if (pixmap.load (fn)) |
insilmaril@408 | 47 |
{ |
insilmaril@426 | 48 |
prepareGeometryChange(); |
insilmaril@408 | 49 |
setPixmap (pixmap); |
insilmaril@408 | 50 |
return true; |
insilmaril@408 | 51 |
} |
insilmaril@408 | 52 |
return false; |
insilmaril@408 | 53 |
} |
insilmaril@0 | 54 |
|
insilmaril@408 | 55 |
bool ImageObj::load (const QPixmap &pm) |
insilmaril@408 | 56 |
{ |
insilmaril@426 | 57 |
prepareGeometryChange(); |
insilmaril@408 | 58 |
setPixmap (pm); |
insilmaril@0 | 59 |
return true; |
insilmaril@0 | 60 |
} |
insilmaril@0 | 61 |
|
insilmaril@0 | 62 |