本文整理汇总了C++中QtVariantProperty::value方法的典型用法代码示例。如果您正苦于以下问题:C++ QtVariantProperty::value方法的具体用法?C++ QtVariantProperty::value怎么用?C++ QtVariantProperty::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QtVariantProperty
的用法示例。
在下文中一共展示了QtVariantProperty::value方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: propertyChanged
void AbstractItemEditor::propertyChanged(QtProperty *property)
{
if (m_updatingBrowser)
return;
BoolBlocker block(m_updatingBrowser);
QtVariantProperty *prop = m_propertyManager->variantProperty(property);
int role;
if ((role = m_propertyToRole.value(prop, -1)) == -1)
// Subproperty
return;
if ((role == ItemFlagsShadowRole && prop->value().toInt() == (int)QListWidgetItem().flags())
|| (role == Qt::DecorationPropertyRole && !qVariantValue<PropertySheetIconValue>(prop->value()).mask())
|| (role == Qt::FontRole && !qVariantValue<QFont>(prop->value()).resolve())) {
prop->setModified(false);
setItemData(role, QVariant());
} else {
prop->setModified(true);
setItemData(role, prop->value());
}
switch (role) {
case Qt::DecorationPropertyRole:
setItemData(Qt::DecorationRole, qVariantFromValue(iconCache()->icon(qVariantValue<PropertySheetIconValue>(prop->value()))));
break;
case Qt::DisplayPropertyRole:
setItemData(Qt::EditRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
break;
case Qt::ToolTipPropertyRole:
setItemData(Qt::ToolTipRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
break;
case Qt::StatusTipPropertyRole:
setItemData(Qt::StatusTipRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
break;
case Qt::WhatsThisPropertyRole:
setItemData(Qt::WhatsThisRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
break;
default:
break;
}
prop->setValue(getItemData(role));
}
示例2: onPropertyChanged
void CPropBrowserCtrl::onPropertyChanged( QtProperty *prop )
{
QString propName = prop->propertyName();
QString propValue = prop->valueText();
// for some reason booleans cannot be extracted from a QtProperty :(
if( propValue.isEmpty() )
{
QtVariantProperty *p = propertyMgr->variantProperty( prop );
if( p != NULL )
propValue = p->value().toString();
}
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement );
if( e == NULL )
return;
e->setProperty( propName.toUtf8().constData(), propValue.toUtf8().constData() );
}
示例3: resetFontSubProperty
bool FontPropertyManager::resetFontSubProperty(QtVariantPropertyManager *vm, QtProperty *property)
{
const PropertyToPropertyMap::iterator it = m_fontSubPropertyToProperty.find(property);
if (it == m_fontSubPropertyToProperty.end())
return false;
QtVariantProperty *fontProperty = vm->variantProperty(it.value());
QVariant v = fontProperty->value();
QFont font = qvariant_cast<QFont>(v);
unsigned mask = font.resolve();
const unsigned flag = fontFlag(m_fontSubPropertyToFlag.value(property));
mask &= ~flag;
font.resolve(mask);
qVariantSetValue(v, font);
fontProperty->setValue(v);
return true;
}
示例4: valueChanged
FontPropertyManager::ValueChangedResult FontPropertyManager::valueChanged(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
{
QtProperty *antialiasingProperty = m_antialiasingToProperty.value(property, 0);
if (!antialiasingProperty) {
if (m_propertyToFontSubProperties.contains(property)) {
updateModifiedState(property, value);
}
return NoMatch;
}
QtVariantProperty *fontProperty = vm->variantProperty(antialiasingProperty);
const QFont::StyleStrategy newValue = indexToAntialiasing(value.toInt());
QFont font = qVariantValue<QFont>(fontProperty->value());
const QFont::StyleStrategy oldValue = font.styleStrategy();
if (newValue == oldValue)
return Unchanged;
font.setStyleStrategy(newValue);
fontProperty->setValue(qVariantFromValue(font));
return Changed;
}