13 : m_name(name), m_variant(variant), m_icon(icon)
22 QString s(this->m_name);
23 s.append(
" ").append(this->m_variant.
toQString(i18n));
29 if (index.
isMyself()) {
return QVariant::fromValue(*
this); }
33 case IndexName:
return QVariant(this->m_name);
34 case IndexVariant:
return this->m_variant;
50 if (
static_cast<int>(i) ==
static_cast<int>(IndexIcon))
52 if (
static_cast<QMetaType::Type
>(variant.type()) == QMetaType::Int)
64 case IndexName: this->
setName(variant.value<QString>());
break;
65 case IndexVariant: this->m_variant = variant;
break;
Value object for icons. An icon is stored in the global icon repository and identified by its index....
CIcons::IconIndex getIndex() const
Index.
bool isSet() const
Icon set?
static const CIcon & iconByIndex(CIcons::IconIndex index)
Icon for given index.
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
QString convertToQString(bool i18n=false) const
Cast as QString.
bool hasIcon() const
Has icon.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
void setName(const QString &name)
Set name.
CNameVariantPair()=default
Default constructor.
swift::misc::CIcons::IconIndex toIcon() const
As icon, not implemented by all classes.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
Non-owning reference to a CPropertyIndex with a subset of its features.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
ColumnIndex
Base class enums.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
QString toQString(bool i18n=false) const
Cast as QString.
Free functions in swift::misc.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.