author | insilmaril |
Fri, 08 Dec 2006 20:18:58 +0000 | |
changeset 409 | 81ffad43d53f |
parent 408 | c2a05fa925a1 |
child 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@0 | 19 |
// cout << "Destr ImageObj\n"; |
insilmaril@0 | 20 |
} |
insilmaril@0 | 21 |
|
insilmaril@0 | 22 |
void ImageObj::copy(ImageObj* other) |
insilmaril@0 | 23 |
{ |
insilmaril@0 | 24 |
setVisibility (other->isVisible() ); |
insilmaril@408 | 25 |
setPixmap (other->QGraphicsPixmapItem::pixmap()); |
insilmaril@408 | 26 |
setPos (other->pos()); |
insilmaril@0 | 27 |
} |
insilmaril@0 | 28 |
|
insilmaril@0 | 29 |
void ImageObj::setVisibility (bool v) |
insilmaril@0 | 30 |
{ |
insilmaril@0 | 31 |
if (v) |
insilmaril@0 | 32 |
show(); |
insilmaril@0 | 33 |
else |
insilmaril@0 | 34 |
hide(); |
insilmaril@0 | 35 |
} |
insilmaril@0 | 36 |
|
insilmaril@0 | 37 |
void ImageObj::save(const QString &fn, const char *format) |
insilmaril@0 | 38 |
{ |
insilmaril@408 | 39 |
pixmap().save (fn,format,-1); |
insilmaril@0 | 40 |
} |
insilmaril@0 | 41 |
|
insilmaril@0 | 42 |
bool ImageObj::load (const QString &fn) |
insilmaril@0 | 43 |
{ |
insilmaril@408 | 44 |
QPixmap pixmap; |
insilmaril@408 | 45 |
if (pixmap.load (fn)) |
insilmaril@408 | 46 |
{ |
insilmaril@408 | 47 |
setPixmap (pixmap); |
insilmaril@408 | 48 |
return true; |
insilmaril@408 | 49 |
} |
insilmaril@408 | 50 |
return false; |
insilmaril@408 | 51 |
} |
insilmaril@0 | 52 |
|
insilmaril@408 | 53 |
bool ImageObj::load (const QPixmap &pm) |
insilmaril@408 | 54 |
{ |
insilmaril@408 | 55 |
setPixmap (pm); |
insilmaril@0 | 56 |
return true; |
insilmaril@0 | 57 |
} |
insilmaril@0 | 58 |
|
insilmaril@0 | 59 |