1 #include "attributeitem.h"
6 AttributeItem::AttributeItem(const QList<QVariant> &data, TreeItem *parent):BranchItem (data,parent)
8 TreeItem::setType (Attribute);
12 AttributeItem::~AttributeItem()
16 void AttributeItem::set (const QString &k, const QString &v, const Type &)
23 void AttributeItem::get (QString &k, QString &v, Type &t)
30 void AttributeItem::setKey (const QString &k)
35 qWarning (QString("AttributeItem::setKey (%1) No table defined!\n").arg(k).ascii());
41 definition=table->getDef(k);
48 qWarning (QString("AttributeItem::setKey (%1) attribute already defined!\n").arg(k).ascii());
54 QString AttributeItem::getKey ()
59 qWarning ("AttributeItem::getKey () No table defined!");
64 qWarning ("AttributeItem::getKey () No attribute defined!");
67 return definition->getKey();
72 void AttributeItem::setValue(const QString &v)
77 qWarning (QString ("AttributeItem::setValue (%1) No table defined!").arg(v));
82 qWarning (QString ("AttributeItem::setValue (%1) No attribute defined!").arg(v));
85 definition->setValue (v);
91 QVariant AttributeItem::getValue()
96 qWarning ("AttributeItem::getValue No table defined!");
101 qWarning ("AttributeItem::getValue No attribute defined!");
104 QVariant v= definition->getValue();
110 void AttributeItem::setType (const Type &t)
115 qWarning ("AttributeItem::setType No table defined!");
120 qWarning ("Attribute::setType No attribute defined!");
123 definition->setType (t);
128 AttributeItem::Type AttributeItem::getAttributeType()
133 qWarning ("AttributeItem::getType No table defined!");
138 qWarning ("AttributeItem::getType No attribute defined!");
141 return definition->getType();
146 QString AttributeItem::getTypeString()
151 qWarning ("AttributeItem::getTypeString No table defined!");
156 qWarning ("Attribute::getTypeString No AttributeItem defined!");
159 return definition->getTypeString();
163 case IntList: return "IntList";
164 case FreeInt: return "FreeInt";
165 case StringList:return "StringList";
166 case FreeString:return "FreeString";
167 case UniqueString: return "UniqueString";
168 default: return "Undefined";
172 void AttributeItem::setInternal(bool b)
177 bool AttributeItem::isInternal()
182 QString AttributeItem::getDataXML()
185 a=attribut ("key",getKey());
186 a+=attribut ("value",getValue().toString() );
187 a+=attribut ("type",getTypeString () );
188 return singleElement ("attribute",a);
191 void AttributeItem::createHeading()
193 setHeadingPlainText (QString ("K: %1 | V: %2").arg(key).arg(value.toString()));