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