21 #include <QModelIndex>
22 #include <QStyleOptionViewItem>
33 auto variant = index.data();
36 return std::optional<std::string>{variant.value<
ComboProperty>().label()};
39 return variant.
value<
bool>() ? std::optional<std::string>{
"True"}
40 : std::optional<std::string>{
"False"};
46 return std::optional<std::string>{std::string()};
49 return std::optional<std::string>{
62 auto value =
cellText(index).value();
63 option->text = QString::fromStdString(value);
65 option->features &= ~QStyleOptionViewItem::HasDisplay;
Custom property to define list of string values with multiple selections.
std::string value() const
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) override
virtual std::optional< std::string > cellText(const QModelIndex &index) const
bool hasCustomDecoration(const QModelIndex &index) const override
Property to carry text, color and identifier.
static QString toString(double val, int decimal_points)
const int default_double_decimals
MVVM_MODEL_EXPORT bool IsColorVariant(const Variant &variant)
Returns true in the case of QColor based variant.
MVVM_MODEL_EXPORT bool IsDoubleVariant(const Variant &variant)
Returns true in the case of double value based variant.
MVVM_MODEL_EXPORT bool IsBoolVariant(const Variant &variant)
Returns true in the case of double value based variant.
MVVM_MODEL_EXPORT bool IsExtPropertyVariant(const Variant &variant)
Returns true in the case of ExternalProperty based variant.
MVVM_MODEL_EXPORT bool IsComboVariant(const Variant &variant)
Returns true in the case of double value based variant.
materialitems.h Collection of materials to populate MaterialModel.