26 #include "../vproperty_p.h"
53 if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role))
55 return d_ptr->VariantValue.toBool() ? TrueText : FalseText;
57 if (column == DPC_Data && Qt::CheckStateRole == role)
59 return d_ptr->VariantValue.toBool() ? Qt::Checked : Qt::Unchecked;
67 if (Qt::CheckStateRole == role)
69 d_ptr->VariantValue = (Qt::Checked ==
static_cast<Qt::CheckState
>(data.toInt()));
79 if (column == DPC_Data)
81 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
The VBoolProperty can take two states: True or False.
virtual bool setData(const QVariant &data, int role=Qt::EditRole) Q_DECL_OVERRIDE
This is used by the model to set the data.
virtual VProperty * clone(bool include_children=true, VProperty *container=NULL) const Q_DECL_OVERRIDE
Clones this property.
virtual Qt::ItemFlags flags(int column=DPC_Name) const Q_DECL_OVERRIDE
Returns item flags.
virtual QString type() const Q_DECL_OVERRIDE
Returns a string containing the type of the property.
static QVariant FalseText
The (translatable) text displayed when the property is set to false (default: "False")
VBoolProperty(const QString &name)
Default constructor.
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const Q_DECL_OVERRIDE
Get the data how it should be displayed.
static QVariant TrueText
The (translatable) text displayed when the property is set to true (default: "True")
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.
virtual Qt::ItemFlags flags(int column=DPC_Name) const
Returns item flags.
VPropertyPrivate * d_ptr
The protected structure holding the member variables (to assure binary compatibility)
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const
Get the data how it should be displayed.