property.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "property.h"
00020
00021 #include <qstring.h>
00022
00023 namespace PropertyLib{
00024
00025 Property::Property(int type, const QString &name, const QString &description,
00026 const QVariant &value, bool save, bool readOnly):
00027 m_type(type), m_name(name), m_description(description), m_value(value), m_save(save),
00028 m_readOnly(readOnly), m_visible(true)
00029 {
00030 }
00031
00032 Property::Property(const QString &name, const QMap<QString, QVariant> &v_valueList,
00033 const QString &description, const QVariant &value, bool save, bool readOnly):
00034 valueList(v_valueList), m_type(ValueFromList), m_name(name),
00035 m_description(description), m_value(value), m_save(save), m_readOnly(readOnly),
00036 m_visible(true)
00037 {
00038 }
00039
00040 Property::~Property()
00041 {
00042 }
00043
00044 bool Property::allowSaving() const
00045 {
00046 return m_save;
00047 }
00048
00049 bool Property::operator<(const Property &prop) const
00050 {
00051 if ((type() < prop.type()) && (name() < prop.name()))
00052 return true;
00053 else
00054 return false;
00055 }
00056
00057 QString Property::name() const
00058 {
00059 return m_name;
00060 }
00061
00062 void Property::setName(const QString &name)
00063 {
00064 m_name = name;
00065 }
00066
00067 int Property::type() const
00068 {
00069 return m_type;
00070 }
00071
00072 void Property::setType(int type)
00073 {
00074 m_type = type;
00075 }
00076
00077 QVariant Property::value() const
00078 {
00079 return m_value;
00080 }
00081
00082 void Property::setValue(const QVariant &value, bool rememberOldValue)
00083 {
00084 if (rememberOldValue)
00085 m_oldValue = m_value;
00086 else
00087 m_oldValue = value;
00088 m_value = value;
00089 }
00090
00091 QString Property::description() const
00092 {
00093 return m_description;
00094 }
00095
00096 void Property::setDescription(const QString &description)
00097 {
00098 m_description = description;
00099 }
00100
00101 void Property::setValueList(const QMap<QString, QVariant> &v_valueList)
00102 {
00103 valueList = v_valueList;
00104 }
00105
00106 bool Property::readOnly() const
00107 {
00108 return m_readOnly;
00109 }
00110
00111 bool Property::visible() const
00112 {
00113 return m_visible;
00114 }
00115
00116 void Property::setVisible( const bool visible )
00117 {
00118 m_visible = visible;
00119 }
00120
00121 QVariant Property::oldValue() const
00122 {
00123 if (m_oldValue.isNull())
00124 return m_value;
00125 else
00126 return m_oldValue;
00127 }
00128
00129 }
This file is part of the documentation for KDevelop Version 3.1.2.