KDevelop API Documentation

PropertyLib::Property Class Reference

Property. More...

#include <property.h>

Inheritance diagram for PropertyLib::Property:

Inheritance graph
[legend]
Collaboration diagram for PropertyLib::Property:

Collaboration graph
[legend]
List of all members.

Public Types

enum  PropertyType {
  Invalid = QVariant::Invalid, Map = QVariant::Map, List = QVariant::List, String = QVariant::String,
  StringList = QVariant::StringList, Font = QVariant::Font, Pixmap = QVariant::Pixmap, Rect = QVariant::Rect,
  Size = QVariant::Size, Color = QVariant::Color, Point = QVariant::Point, Integer = QVariant::Int,
  Boolean = QVariant::Bool, Double = QVariant::Double, Cursor = QVariant::Cursor, SizePolicy = QVariant::SizePolicy,
  Date = QVariant::Date, DateTime = QVariant::DateTime, ValueFromList = 2000, Symbol = 2001,
  FontName = 2002, FileURL = 2003, DirectoryURL = 2004, UserDefined = 3000
}
 PropertyType. More...

Public Member Functions

 Property ()
 Constructs empty property.
 Property (int type, const QString &name, const QString &description, const QVariant &value=QVariant(), bool save=true, bool readOnly=false)
 Constructs property.
 Property (const QString &name, const QMap< QString, QVariant > &v_valueList, const QString &description, const QVariant &value=QVariant(), bool save=true, bool readOnly=false)
 Constructs property with ValueFromList type.
virtual ~Property ()
virtual bool operator< (const Property &prop) const
virtual QString name () const
virtual void setName (const QString &name)
 Sets the name of the property.
virtual int type () const
virtual void setType (int type)
 Sets the type of the property.
virtual QVariant value () const
virtual void setValue (const QVariant &value, bool rememberOldValue=true)
 Sets the value of the property.
virtual QString description () const
virtual void setDescription (const QString &description)
 Sets the description of the property.
virtual void setValueList (const QMap< QString, QVariant > &list)
 Sets the string-to-value correspondence list of the property.
virtual bool allowSaving () const
 Tells if the property can be saved to a stream, xml, etc.
virtual bool readOnly () const
 Tells if the property is read only.
virtual bool visible () const
 Tells if the property is visible.
virtual void setVisible (const bool visible)
 Set the visibility.
virtual QVariant oldValue () const
 Gets the previous property value.

Public Attributes

QMap< QString, QVariantvalueList
 The string-to-value correspondence list of the property.

Private Attributes

int m_type
QString m_name
QString m_description
QVariant m_value
QVariant m_oldValue
bool m_save
bool m_readOnly
bool m_visible

Detailed Description

Property.

It includes support for QStringList properties, an i18n'ed label and stores an old value to allow undo.

Contains name, type and value.

Type can be one of predefined types (including standard QVariant types) by PropertyType enum or custom user type. User defined types should have values more than 3000.

Value is a QVariant.

Property can optionally have a list of possible values. In that case use ValueFromList type and valueList member. Use description for i18n'ed label.

Examples: creating property:

Property *property = new Property(String, name, description, value)
using convenience constructor to create property of ValueFromList type:
Property *property = new Property(name, possibleValuesList, description, value);

Definition at line 61 of file property.h.


Member Enumeration Documentation

enum PropertyLib::Property::PropertyType
 

PropertyType.

Integers that represent the type of the property.

Enumeration values:
Invalid  invalid property type
Map  QMap<QString, QVariant>.
List  QValueList<QVariant>.
String  string
StringList  string list
Font  font
Pixmap  pixmap
Rect  rectangle (x,y, width, height)
Size  size (width, height)
Color  color
Point  point (x,y)
Integer  integer
Boolean  boolean
Double  double
Cursor  cursor
SizePolicy  size policy (horizontal, vertical)
Date  date
DateTime  date and time
ValueFromList  string value from a list
Symbol  unicode symbol code
FontName  font name, e.g

"times new roman"

FileURL  url of a file
DirectoryURL  url of a directory
UserDefined  plugin defined properties should start here

Definition at line 65 of file property.h.


Constructor & Destructor Documentation

PropertyLib::Property::Property  )  [inline]
 

Constructs empty property.

Definition at line 116 of file property.h.

PropertyLib::Property::Property int  type,
const QString name,
const QString description,
const QVariant value = QVariant(),
bool  save = true,
bool  readOnly = false
 

Constructs property.

Definition at line 25 of file property.cpp.

PropertyLib::Property::Property const QString name,
const QMap< QString, QVariant > &  v_valueList,
const QString description,
const QVariant value = QVariant(),
bool  save = true,
bool  readOnly = false
 

Constructs property with ValueFromList type.

Definition at line 32 of file property.cpp.

PropertyLib::Property::~Property  )  [virtual]
 

Definition at line 40 of file property.cpp.


Member Function Documentation

bool PropertyLib::Property::allowSaving  )  const [virtual]
 

Tells if the property can be saved to a stream, xml, etc.

There is a possibility to use "GUI" properties that aren't stored but used only in a GUI.

Definition at line 44 of file property.cpp.

QString PropertyLib::Property::description  )  const [virtual]
 

Returns:
the description of the property.

Definition at line 91 of file property.cpp.

Referenced by PropertyLib::MultiProperty::description().

QString PropertyLib::Property::name  )  const [virtual]
 

Returns:
the name of the property.

Definition at line 57 of file property.cpp.

Referenced by PropertyLib::PropertyList::addProperty(), operator<(), PropertyLib::MultiProperty::operator==(), PropertyLib::PropertyEditor::propertyValueChanged(), and PropertyLib::PropertyList::removeProperty().

QVariant PropertyLib::Property::oldValue  )  const [virtual]
 

Gets the previous property value.

Definition at line 121 of file property.cpp.

References m_oldValue.

Referenced by PropertyLib::MultiProperty::undo().

bool PropertyLib::Property::operator< const Property prop  )  const [virtual]
 

Definition at line 49 of file property.cpp.

References name(), and type().

bool PropertyLib::Property::readOnly  )  const [virtual]
 

Tells if the property is read only.

Definition at line 106 of file property.cpp.

Referenced by PropertyLib::MultiProperty::readOnly().

void PropertyLib::Property::setDescription const QString description  )  [virtual]
 

Sets the description of the property.

Definition at line 96 of file property.cpp.

References m_description.

Referenced by PropertyLib::MultiProperty::setDescription().

void PropertyLib::Property::setName const QString name  )  [virtual]
 

Sets the name of the property.

Definition at line 62 of file property.cpp.

References m_name.

void PropertyLib::Property::setType int  type  )  [virtual]
 

Sets the type of the property.

Definition at line 72 of file property.cpp.

References m_type.

Referenced by PropertyLib::PropertyWidgetProxy::setWidget().

void PropertyLib::Property::setValue const QVariant value,
bool  rememberOldValue = true
[virtual]
 

Sets the value of the property.

Reimplemented in PropertyLib::ChildProperty.

Definition at line 82 of file property.cpp.

References m_oldValue, and m_value.

Referenced by PropertyLib::MultiProperty::setValue(), and PropertyLib::MultiProperty::undo().

void PropertyLib::Property::setValueList const QMap< QString, QVariant > &  list  )  [virtual]
 

Sets the string-to-value correspondence list of the property.

This is used to create comboboxes-like property editors.

Definition at line 101 of file property.cpp.

References valueList.

Referenced by PropertyLib::MultiProperty::setValueList().

void PropertyLib::Property::setVisible const bool  visible  )  [virtual]
 

Set the visibility.

Definition at line 116 of file property.cpp.

References m_visible.

int PropertyLib::Property::type  )  const [virtual]
 

Returns:
the type of the property.

Definition at line 67 of file property.cpp.

Referenced by operator<(), and PropertyLib::MultiProperty::operator==().

QVariant PropertyLib::Property::value  )  const [virtual]
 

Returns:
the value of the property.

Reimplemented in PropertyLib::ChildProperty.

Definition at line 77 of file property.cpp.

Referenced by PropertyLib::PropertyEditor::propertyValueChanged(), and PropertyLib::MultiProperty::value().

bool PropertyLib::Property::visible  )  const [virtual]
 

Tells if the property is visible.

Definition at line 111 of file property.cpp.

Referenced by PropertyLib::MultiProperty::visible().


Member Data Documentation

QString PropertyLib::Property::m_description [private]
 

Definition at line 169 of file property.h.

Referenced by setDescription().

QString PropertyLib::Property::m_name [private]
 

Definition at line 168 of file property.h.

Referenced by setName().

QVariant PropertyLib::Property::m_oldValue [private]
 

Definition at line 171 of file property.h.

Referenced by oldValue(), and setValue().

bool PropertyLib::Property::m_readOnly [private]
 

Definition at line 173 of file property.h.

bool PropertyLib::Property::m_save [private]
 

Definition at line 172 of file property.h.

int PropertyLib::Property::m_type [private]
 

Definition at line 167 of file property.h.

Referenced by setType().

QVariant PropertyLib::Property::m_value [private]
 

Definition at line 170 of file property.h.

Referenced by setValue().

bool PropertyLib::Property::m_visible [private]
 

Definition at line 174 of file property.h.

Referenced by setVisible().

QMap<QString, QVariant> PropertyLib::Property::valueList
 

The string-to-value correspondence list of the property.

Definition at line 147 of file property.h.

Referenced by setValueList().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:33:22 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003