imageobj.cpp
author insilmaril
Tue, 23 Jan 2007 11:50:56 +0000
changeset 423 7019762f8701
parent 421 5522d1da7e37
child 426 e0a3449f4458
permissions -rw-r--r--
1.8.65 Various fixes
     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,100);
    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