attributeitem.h
author insilmaril
Mon, 14 Jun 2010 13:59:17 +0000
changeset 848 e265f07f2173
parent 823 0bba81dde1bc
permissions -rw-r--r--
Fixed tmp relink, colored headings in TreeView
     1 #ifndef ATTRIBUTEITEM_H
     2 #define ATTRIBUTEITEM_H
     3 
     4 #include <QStringList>
     5 #include <QVariant>
     6 
     7 #include "branchitem.h"
     8 
     9 /*! \brief A key and a value 
    10     The data itself is stored in Attribute Definitions (AttributeDef). 
    11 	A list of these tables AttributeTable is maintained for every MapEditor.
    12 */
    13 class AttributeItem:public BranchItem {
    14 public:
    15 enum Type {
    16 	Undefined,	//!< Undefined type
    17 	IntList,	//!< Free integer
    18 	FreeInt,	//!< Free integer
    19 	StringList, //!< List of strings, one can be attribute value
    20 	FreeString,	//!< Any string can be attribute value, not unique
    21 	UniqueString//!< UniqueString, e.g. for IDs
    22 };
    23 
    24 	AttributeItem(const QList<QVariant> &data, TreeItem *parent = 0);
    25 	virtual ~AttributeItem();
    26 	void set (const QString &k, const QString &v, const Type &t);
    27 	void get (QString &k, QString &v, Type &t);
    28 	void setKey (const QString &k, const Type &t);
    29 	QString getKey ();
    30 	void setValue (const QString &v);
    31 	QVariant getValue ();
    32 	void setType (const Type &t);
    33 	AttributeItem::Type getAttributeType ();
    34 	QString getTypeString ();
    35 	void setInternal (bool b);
    36 	bool isInternal();
    37 	QString getDataXML();
    38 protected:
    39 	bool internal;			//!< Internal attributes cannot be edited by user
    40 	QString key;
    41 	QVariant value;
    42 	Type attrType;
    43 };
    44 
    45 #endif
    46