mapitem.h
author insilmaril
Tue, 07 Jul 2009 09:34:24 +0000
changeset 779 1fb50e79661c
parent 777 8acac4fade1b
child 791 f1006de05c54
permissions -rw-r--r--
Hiding of links works again
     1 #ifndef MAPITEM_H
     2 #define MAPITEM_H
     3 
     4 #include <QPointF>
     5 
     6 //#include "xmlobj.h"
     7 #include "treeitem.h"
     8 
     9 class LinkableMapObj;
    10 
    11 /*! /brief MapItem is used to store information of MapObj and inherited
    12    classes.
    13  
    14 	This is done even while no QGraphicsView is availabe. This is useful
    15 	if e.g. on a small device like a cellphone te full map is not used,
    16 	but just a treeview instead.
    17 */
    18 
    19 class MapItem:public TreeItem
    20 {
    21 public:
    22 	enum PositionMode {Unused,Absolute,Relative};
    23 protected:
    24 	QPointF pos;
    25 	PositionMode posMode;
    26 
    27 public:
    28 	MapItem();
    29 	MapItem(const QList<QVariant> &data, TreeItem *parent = 0);
    30 
    31 	void init();
    32 
    33 	/*! Overloaded from TreeItem. Used to set parObj in LinkableMapObj */
    34 	virtual void appendChild (TreeItem *item);
    35 
    36 	/*! Used to save relative position while map is not in QGraphicsView */
    37 	virtual void setRelPos(const QPointF&);	
    38 
    39 	/*! Used to save absolute position while map is not in QGraphicsView */
    40 	virtual void setAbsPos(const QPointF&);	
    41 
    42 	/*! Tell object to use e.g. absolute positioning for mapcenter. 
    43 	    Defaulst is MapItem::Unused */
    44 	void setPositionMode (PositionMode mode);
    45 
    46 
    47 protected:
    48 	bool hideLinkUnselected;
    49 public:
    50 	/*! Hide link if item is not selected */
    51 	virtual void setHideLinkUnselected(bool);
    52 
    53 	/*! Check if link is hidden for unselected items */
    54 	virtual bool getHideLinkUnselected();
    55 
    56 	virtual QString getMapAttr();	//! Get attributes for saving as XML
    57 
    58 
    59 
    60 protected:
    61 	LinkableMapObj *lmo;
    62 public:
    63 	/*! Returns pointer to related LinkableMapObj in QGraphicsView */
    64 	virtual LinkableMapObj* getLMO();
    65 
    66 	/*! Set pointer to related LinkableMapObj in QGraphicsView */
    67 	virtual void setLMO (LinkableMapObj*);
    68 
    69 	/*! Initialize LinkableMapObj with data in MapItem */
    70 	virtual void initLMO();
    71 
    72 };
    73 
    74 
    75 #endif