本文整理汇总了C++中internal::internalproperty::Pointer::toVariantProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::toVariantProperty方法的具体用法?C++ Pointer::toVariantProperty怎么用?C++ Pointer::toVariantProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类internal::internalproperty::Pointer
的用法示例。
在下文中一共展示了Pointer::toVariantProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDynamicTypeNameAndValue
void VariantProperty::setDynamicTypeNameAndValue(const QString &type, const QVariant &value)
{
Internal::WriteLocker locker(model());
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (type.isEmpty()) {
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name());
}
if (internalNode()->hasProperty(name())) { //check if oldValue != value
Internal::InternalProperty::Pointer internalProperty = internalNode()->property(name());
if (internalProperty->isVariantProperty()
&& internalProperty->toVariantProperty()->value() == value
&& internalProperty->toVariantProperty()->dynamicTypeName() == type)
return;
}
if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isVariantProperty())
model()->d->removeProperty(internalNode()->property(name()));
model()->d->setDynamicVariantProperty(internalNode(), name(), type, value);
}
示例2: setValue
void VariantProperty::setValue(const QVariant &value)
{
Internal::WriteLocker locker(model());
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (isDynamic())
qWarning() << "Calling VariantProperty::setValue on dynamic property.";
if (value.isNull())
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name());
if (internalNode()->hasProperty(name())) { //check if oldValue != value
Internal::InternalProperty::Pointer internalProperty = internalNode()->property(name());
if (internalProperty->isVariantProperty()
&& internalProperty->toVariantProperty()->value() == value
&& dynamicTypeName().isEmpty())
return;
}
if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isVariantProperty())
model()->d->removeProperty(internalNode()->property(name()));
model()->d->setVariantProperty(internalNode(), name(), value);
}