59 #include <QLatin1String>
61 #include <QSizePolicy>
62 #include <QStaticStringData>
63 #include <QStringData>
64 #include <QStringDataPtr>
66 #include "../vproperty_p.h"
86 const QAbstractItemDelegate *delegate)
91 QLabel *labelTextEditor =
new QLabel(parent);
92 labelTextEditor->setAlignment(Qt::AlignLeft | Qt::AlignTop);
93 labelTextEditor->setLocale(parent->locale());
94 labelTextEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
95 labelTextEditor->setText(d_ptr->VariantValue.toString());
97 d_ptr->editor = labelTextEditor;
103 const QLabel *labelTextEditor = qobject_cast<const QLabel*>(editor);
106 return labelTextEditor->text();
109 return QVariant(QString());
114 if (key == QLatin1String(
"TypeForParent"))
116 setTypeForParent(value.toInt());
122 if (key == QLatin1String(
"TypeForParent"))
124 return typeForParent;
132 QStringList settings;
133 settings << QStringLiteral(
"TypeForParent");
139 return QStringLiteral(
"label");
149 emit childChanged(value, typeForParent);
154 return typeForParent;
159 typeForParent = value;
Class for holding a string property.
virtual void updateParent(const QVariant &value) Q_DECL_OVERRIDE
int getTypeForParent() const
virtual void setSetting(const QString &key, const QVariant &value) Q_DECL_OVERRIDE
Sets the settings.
virtual QString type() const Q_DECL_OVERRIDE
Returns a string containing the type of the property.
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &options, const QAbstractItemDelegate *delegate) Q_DECL_OVERRIDE
Returns an editor widget, or NULL if it doesn't supply one.
virtual QVariant getSetting(const QString &key) const Q_DECL_OVERRIDE
Get the settings. This function has to be implemented in a subclass in order to have an effect.
virtual QVariant getEditorData(const QWidget *editor) const Q_DECL_OVERRIDE
Gets the data from the widget.
virtual QStringList getSettingKeys() const Q_DECL_OVERRIDE
Returns the list of keys of the property's settings.
VLabelProperty(const QString &name, const QMap< QString, QVariant > &settings)
void setTypeForParent(int value)
virtual Q_REQUIRED_RESULT VProperty * clone(bool include_children=true, VProperty *container=nullptr) const Q_DECL_OVERRIDE
Clones this property.
QVariant VariantValue
The property's value. This does not have to be used by subclasses, but it makes sense in cases where ...
virtual Q_REQUIRED_RESULT VProperty * clone(bool include_children=true, VProperty *container=nullptr) const
Clones this property.
VPropertyPrivate * d_ptr
The protected structure holding the member variables (to assure binary compatibility)
virtual QVariant getSetting(const QString &key) const
Get the settings. This function has to be implemented in a subclass in order to have an effect.
virtual void setSettings(const QMap< QString, QVariant > &settings)
Sets the settings by calling the overloaded setSetting(const QString &key, const QVariant &value) for...