lib/widgets/propeditor/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 <qstring.h>
00020
#include <qwidget.h>
00021
00022
#include "propertywidget.h"
00023
#include "propertyeditor.h"
00024
#include "property.h"
00025
00026
#include "plineedit.h"
00027
#include "pspinbox.h"
00028
#include "plinestyle.h"
00029
#include "pfontcombo.h"
00030
#include "psymbolcombo.h"
00031
#include "pcombobox.h"
00032
#include "pcolorcombo.h"
00033
#include "pstringlistedit.h"
00034
#include "pcheckbox.h"
00035
#include "pdoublenuminput.h"
00036
00037 Property::Property(
int type,
QString name,
QString description,
QVariant value,
bool save):
00038 m_type(type), m_name(name), m_description(description), m_value(value), m_save(save)
00039 {
00040 }
00041
00042 Property::Property(
QString name,
QMap<QString, QString> v_correspList,
00043
QString description,
QVariant value,
bool save):
00044 correspList(v_correspList),
00045 m_type(
ValueFromList), m_name(name), m_description(description), m_value(value),
00046 m_save(save)
00047 {
00048
00049 }
00050
00051 Property::~Property()
00052 {
00053 }
00054
00055 bool Property::allowSaving()
00056 {
00057
return m_save;
00058 }
00059
00060 bool Property::operator<(
const Property &prop)
const
00061
{
00062
if ((
type() < prop.
type()) && (
name() < prop.
name()))
00063
return true;
00064
else
00065
return false;
00066 }
00067
00068 QString Property::name()
const
00069
{
00070
return m_name;
00071 }
00072
00073 void Property::setName(
QString name)
00074 {
00075
m_name = name;
00076 }
00077
00078 int Property::type()
const
00079
{
00080
return m_type;
00081 }
00082
00083 void Property::setType(
int type)
00084 {
00085
m_type = type;
00086 }
00087
00088 QVariant Property::value()
const
00089
{
00090
return m_value;
00091 }
00092
00093 void Property::setValue(
QVariant value)
00094 {
00095
m_value = value;
00096 }
00097
00098 QString Property::description()
const
00099
{
00100
return m_description;
00101 }
00102
00103 void Property::setDescription(
QString description)
00104 {
00105
m_description = description;
00106 }
00107
00108 QWidget *
Property::editorOfType(
PropertyEditor *editor)
00109 {
00110
00111
00112
00113
00114
00115
switch (
type())
00116 {
00117
case List:
00118
case Map:
00119
return new QWidget(0);
00120
00121
case Integer:
00122
return new PSpinBox(editor,
name(),
value(), 0, 10000, 1, 0);
00123
00124
case Double:
00125
return new PDoubleNumInput(editor,
name(),
value(), 0);
00126
00127
case Boolean:
00128
return new PCheckBox(editor,
name(),
value(), 0);
00129
00130
case StringList:
00131
return new PStringListEdit(editor,
name(),
value(), 0);
00132
00133
case Color:
00134
return new PColorCombo(editor,
name(),
value(), 0);
00135
00136
case FontName:
00137
return new PFontCombo(editor,
name(),
value(), 0);
00138
00139
case Symbol:
00140
return new PSymbolCombo(editor,
name(),
value(), 0);
00141
00142
case LineStyle:
00143
return new PLineStyle(editor,
name(),
value(), 0);
00144
00145
case ValueFromList:
00146
return new PComboBox(editor,
name(),
value(), &
correspList,
false, 0, 0);
00147
00148
case FieldName:
00149
case String:
00150
default:
00151
return new PLineEdit(editor,
name(),
value(), 0);
00152 }
00153
return 0;
00154 }
00155
00156 void Property::setCorrespList(
QMap<QString, QString> list)
00157 {
00158
correspList = list;
00159 }
This file is part of the documentation for KDevelop Version 3.0.4.