00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "itemproperties.h"
00023 #include "qvcore/qvpropertycontainer.h"
00024
00025
00026
00027 ItemProperties::ItemProperties(QString type): containerType(type)
00028 {
00029 }
00030
00031
00032 ItemProperties::ItemProperties(QString type, QVPropertyContainer *container): containerType(type)
00033 {
00034 QList<QString> prop( container->getPropertyList() );
00035
00036 for (int i = 0; i < prop.size(); i++)
00037 {
00038 QVPropertyContainer::PropertyFlags flags = container->getPropertyFlags(prop[i]);
00039 if ( !(flags & (QVPropertyContainer::guiInvisible | QVPropertyContainer::internalProp)) )
00040 {
00041 properties.append( prop[i] );
00042 types.append( container->getPropertyType(prop[i]) );
00043 inputs.append( container->isInput(prop[i]) );
00044 outputs.append( container->isOutput(prop[i]) );
00045 }
00046 }
00047 }
00048
00049 QString ItemProperties::getType() const
00050 {
00051 return containerType;
00052 }
00053
00054 QList<QString> ItemProperties::getProperties() const
00055 {
00056 return properties;
00057 }
00058
00059 int ItemProperties::propertyType(const uint i) const
00060 {
00061 if (i >= (uint)types.size()) return 0;
00062 return types[i];
00063 }
00064
00065 bool ItemProperties::isInput(const uint i) const
00066 {
00067 if (i >= (uint)inputs.size()) return false;
00068 return inputs[i];
00069 }
00070
00071 bool ItemProperties::isOutput(const uint i) const
00072 {
00073 if (i >= (uint)outputs.size()) return false;
00074 return outputs[i];
00075 }
00076
00077 void ItemProperties::insertProperty(int pos, QString name, int type, bool input, bool output)
00078 {
00079 if ( (pos >= 0) && (pos <= properties.size()) )
00080 {
00081 properties.insert(pos, name);
00082 types.insert(pos, type);
00083 inputs.insert(pos, input);
00084 outputs.insert(pos, output);
00085 }
00086 }
00087
00088 void ItemProperties::deleteProperty(int pos)
00089 {
00090 if ( (pos >= 0) && (pos <= properties.size()) )
00091 {
00092 properties.removeAt(pos);
00093 types.removeAt(pos);
00094 inputs.removeAt(pos);
00095 outputs.removeAt(pos);
00096 }
00097 }
00098
00099 void ItemProperties::deleteProperty(QString name)
00100 {
00101 deleteProperty(properties.indexOf(name));
00102 }
00103