当前位置: 首页>>代码示例>>C++>>正文


C++ QtVariantProperty::setValue方法代码示例

本文整理汇总了C++中QtVariantProperty::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QtVariantProperty::setValue方法的具体用法?C++ QtVariantProperty::setValue怎么用?C++ QtVariantProperty::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QtVariantProperty的用法示例。


在下文中一共展示了QtVariantProperty::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QString

QtProperty *CrossCommonPropertyGroup::extrackCategoryAxisProperty(QtVariantPropertyManager *manager,
                             QHash<QString, QtVariantProperty *> &propertyTable)
{
    QtProperty          *parameters;
    QtVariantProperty   *item;

    parameters = manager->addProperty(QtVariantPropertyManager::groupTypeId(),
                                      QString(QObject::tr("类型轴属性")));

    item = manager->addProperty(QVariant::String, QString(QObject::tr("名称")));
    item->setValue(QObject::tr("类型轴"));
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/category_axis/name", item);

    item = manager->addProperty(QVariant::Color, QString(QObject::tr("颜色")));
    item->setValue(QColor(0, 0, 0, 255));
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/category_axis/color", item);

    item = manager->addProperty(QVariant::Bool, QString(QObject::tr("标签可见")));
    item->setValue(true);
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/category_axis/label_is_visible", item);

    return parameters;
}
开发者ID:yujiajia,项目名称:Just-Go,代码行数:26,代码来源:cross_common_property_group.cpp

示例2: updateClassProperties

void ObjectControllerPrivate::updateClassProperties(const QMetaObject *metaObject, bool recursive)
{
    if (!metaObject)
        return;

    if (recursive)
        updateClassProperties(metaObject->superClass(), recursive);

    QtProperty *classProperty = m_classToProperty.value(metaObject);
    if (!classProperty)
        return;

    for (int idx = metaObject->propertyOffset(); idx < metaObject->propertyCount(); idx++) {
        QMetaProperty metaProperty = metaObject->property(idx);
        if (metaProperty.isReadable()) {
            if (m_classToIndexToProperty.contains(metaObject) && m_classToIndexToProperty[metaObject].contains(idx)) {
                QtVariantProperty *subProperty = m_classToIndexToProperty[metaObject][idx];
                if (metaProperty.isEnumType()) {
                    if (metaProperty.isFlagType())
                        subProperty->setValue(flagToInt(metaProperty.enumerator(), metaProperty.read(m_object).toInt()));
                    else
                        subProperty->setValue(enumToInt(metaProperty.enumerator(), metaProperty.read(m_object).toInt()));
                } else {
                    subProperty->setValue(metaProperty.read(m_object));
                }
            }
        }
    }
}
开发者ID:Elv13,项目名称:Kimberlite,代码行数:29,代码来源:objectcontroller.cpp

示例3: resetProperty

void AbstractItemEditor::resetProperty(QtProperty *property)
{
    if (m_propertyManager->resetFontSubProperty(property))
        return;

    if (m_propertyManager->resetIconSubProperty(property))
        return;

    BoolBlocker block(m_updatingBrowser);

    QtVariantProperty *prop = m_propertyManager->variantProperty(property);
    int role = m_propertyToRole.value(prop);
    if (role == ItemFlagsShadowRole)
        prop->setValue(qVariantFromValue((int)QListWidgetItem().flags()));
    else
        prop->setValue(QVariant(prop->valueType(), (void *)0));
    prop->setModified(false);

    setItemData(role, QVariant());
    if (role == Qt::DecorationPropertyRole)
        setItemData(Qt::DecorationRole, qVariantFromValue(QIcon()));
    if (role == Qt::DisplayPropertyRole)
        setItemData(Qt::EditRole, qVariantFromValue(QString()));
    if (role == Qt::ToolTipPropertyRole)
        setItemData(Qt::ToolTipRole, qVariantFromValue(QString()));
    if (role == Qt::StatusTipPropertyRole)
        setItemData(Qt::StatusTipRole, qVariantFromValue(QString()));
    if (role == Qt::WhatsThisPropertyRole)
        setItemData(Qt::WhatsThisRole, qVariantFromValue(QString()));
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:30,代码来源:itemlisteditor.cpp

示例4: postInitializeProperty

    void FontPropertyManager::postInitializeProperty(QtVariantPropertyManager *vm,
                                                     QtProperty *property,
                                                     int type,
                                                     int enumTypeId)
    {
        if (type != QVariant::Font)
            return;

        // This will cause a recursion
        QtVariantProperty *antialiasing = vm->addProperty(enumTypeId, QCoreApplication::translate("FontPropertyManager", "Antialiasing"));
        const QFont font = qVariantValue<QFont>(vm->variantProperty(property)->value());

        antialiasing->setAttribute(QLatin1String("enumNames"), m_aliasingEnumNames);
        antialiasing->setValue(antialiasingToIndex(font.styleStrategy()));
        property->addSubProperty(antialiasing);

        m_propertyToAntialiasing[property] = antialiasing;
        m_antialiasingToProperty[antialiasing] = property;
        // Fiddle family names
        if (!m_familyMappings.empty()) {
            const PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(m_createdFontProperty);
            QtVariantProperty *familyProperty = vm->variantProperty(it.value().front());
            const QString enumNamesAttribute = QLatin1String("enumNames");
            QStringList plainFamilyNames = familyProperty->attributeValue(enumNamesAttribute).toStringList();
            // Did someone load fonts or something?
            if (m_designerFamilyNames.size() != plainFamilyNames.size())
                m_designerFamilyNames = designerFamilyNames(plainFamilyNames, m_familyMappings);
            familyProperty->setAttribute(enumNamesAttribute, m_designerFamilyNames);
        }
        // Next
        m_createdFontProperty = 0;
    }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例5: setupProperty

	void CPropBrowserCtrl::setupProperty( const SPropEntry &prop, const CInterfaceElement *element )
	{
		QtVariantProperty *p = NULL;
		QVariant v;
		
		if( prop.propType == "string" )
		{
			p = propertyMgr->addProperty( QVariant::String, prop.propName.c_str() );
			v = element->getProperty( prop.propName ).c_str();
		}
		else
		if( prop.propType == "bool" )
		{
			p = propertyMgr->addProperty( QVariant::Bool, prop.propName.c_str() );
			bool value = false;
			NLMISC::fromString( element->getProperty( prop.propName ), value );
			v = value;
		}
		else
		if( prop.propType == "int" )
		{
			p = propertyMgr->addProperty( QVariant::Int, prop.propName.c_str() );
			sint32 value = 0;
			NLMISC::fromString( element->getProperty( prop.propName ), value );
			v = value;
		}

		if( p == NULL )
			return;

		p->setValue( v );
		browser->addProperty( p );
	}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:33,代码来源:property_browser_ctrl.cpp

示例6: main

int main(int argc, char **argv)
{
	QApplication app(argc, argv);
	
	Test t;

	QtVariantPropertyManager *variantManager = new VariantManager();
	QtVariantProperty *priority = variantManager->addProperty(QVariant::Int, "Priority");

	priority->setToolTip("Task Priority");

	priority->setAttribute("minimum", 1);
	priority->setAttribute("maximum", 5);
	priority->setValue(3);

	QtVariantProperty *reportType = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(), "Report Type");
	QStringList types;
	types << "Bug" << "Suggestion" << "To Do";
	reportType->setAttribute("enumNames", types);
	reportType->setValue(1); // current value will be "Suggestion"

	QtVariantProperty *task1 = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(), "Task 1");

	task1->addSubProperty(priority);
	task1->addSubProperty(reportType);

	QtTreePropertyBrowser *browser = new QtTreePropertyBrowser();

	QtVariantEditorFactory *variantFactory = new VariantFactory();
	browser->setFactoryForManager(variantManager, variantFactory);

	browser->addProperty(task1);
	browser->show();

	QtVariantProperty *example = variantManager->addProperty(VariantManager::filePathTypeId(), "Example");
	example->setValue("main.cpp");
	example->setAttribute("filter", "Source files (*.cpp *.c)");

	
	QObject::connect(variantManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)),
					&t, SLOT(onValueChanged(QtProperty * , const QVariant &)));

	task1->addSubProperty(example);

	return app.exec();
}
开发者ID:nhatson1987,项目名称:QtPropBuildTest,代码行数:46,代码来源:main.cpp

示例7: setValue

    void FontPropertyManager::setValue(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
    {
        updateModifiedState(property, value);

        if (QtProperty *antialiasingProperty = m_propertyToAntialiasing.value(property, 0)) {
            QtVariantProperty *antialiasing = vm->variantProperty(antialiasingProperty);
            if (antialiasing) {
                QFont font = qVariantValue<QFont>(value);
                antialiasing->setValue(antialiasingToIndex(font.styleStrategy()));
            }
        }
    }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例8: createQtProperty

static QtVariantProperty* createQtProperty(
        const Property* prop, QtVariantPropertyManager* varPropMgr)
{
    typedef typename PropTraits<T>::PropertyType PropertyType;
    auto castedProp = static_cast<const PropertyType*>(prop);
    QtVariantProperty* qtProp =
            varPropMgr->addProperty(
                PropTraits<T>::qVariantTypeId(), prop->label());
    QtPropertyInit<T>::func(qtProp, castedProp);
    qtProp->setValue(PropertyQVariantCast<T>::toQVariantValue(castedProp));
    return qtProp;
}
开发者ID:fougue,项目名称:mayo,代码行数:12,代码来源:widget_document_item_props.cpp

示例9: _updateShapeProperty

void Mapper::_updateShapeProperty(QtProperty* shapeItem, MShape* shape)
{
  QList<QtProperty*> pointItems = shapeItem->subProperties();
  for (int i=0; i<shape->nVertices(); i++)
  {
    // XXX mesh control points are not added to properties
    if (i < pointItems.size())
    {
      QtVariantProperty* pointItem = (QtVariantProperty*)pointItems[i];
      const QPointF& p = shape->getVertex(i);
      pointItem->setValue(p);
    }
  }
}
开发者ID:flv0,项目名称:mapmap,代码行数:14,代码来源:Mapper.cpp

示例10: setupProperties

 //-----------------------------------------------------------------------
 // Class MacroLinkItem
 //-----------------------------------------------------------------------
 void MacroLinkItem::setupProperties(WndProperties& propWnd) const
 {
   QtVariantPropertyManager& propManager = propWnd.infoPropertyManager();
   QtVariantProperty* item;
   QtVariantProperty* group;
   group = propManager.addProperty(QtVariantPropertyManager::groupTypeId(), QObject::tr("General"));
   item = propManager.addProperty(QVariant::String, QObject::tr("Link type"));
   item->setValue(edge().srcPin().data()->dataRef().staticCast<app::MacroPin>()->getType());
   group->addSubProperty(item);
   group = propManager.addProperty(QtVariantPropertyManager::groupTypeId(), QObject::tr("Source"));
   item = propManager.addProperty(QVariant::String, QObject::tr("Macro"));
   item->setValue(edge().srcPin().data()->vertex().dataRef().staticCast<app::Macro>()->getName());
   group->addSubProperty(item);
   item = propManager.addProperty(QVariant::String, QObject::tr("Output pin"));
   item->setValue(edge().srcPin().data()->dataRef().staticCast<app::MacroPin>()->getName());
   group->addSubProperty(item);
   group = propManager.addProperty(QtVariantPropertyManager::groupTypeId(), QObject::tr("Destination"));
   item = propManager.addProperty(QVariant::String, QObject::tr("Macro"));
   item->setValue(edge().destPin().data()->vertex().dataRef().staticCast<app::Macro>()->getName());
   group->addSubProperty(item);
   item = propManager.addProperty(QVariant::String, QObject::tr("Input pin"));
   item->setValue(edge().destPin().data()->dataRef().staticCast<app::MacroPin>()->getName());
   group->addSubProperty(item);
 }
开发者ID:llibuda,项目名称:impresario,代码行数:27,代码来源:pgeitems.cpp

示例11: _buildShapeProperty

void Mapper::_buildShapeProperty(QtProperty* shapeItem, MShape* shape)
{
  for (int i=0; i<shape->nVertices(); i++)
  {
    // Add point.
    QtVariantProperty* pointItem = _variantManager->addProperty(QVariant::PointF,
                                                                QObject::tr("Point %1").arg(i));

    const QPointF& p = shape->getVertex(i);
    pointItem->setValue(p);

    shapeItem->addSubProperty(pointItem);
    _propertyToVertex[pointItem] = std::make_pair(shape, i);
  }

}
开发者ID:flv0,项目名称:mapmap,代码行数:16,代码来源:Mapper.cpp

示例12: 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));
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:45,代码来源:itemlisteditor.cpp

示例13: updateCustomProperties

void PropertyBrowser::updateCustomProperties()
{
    mUpdating = true;

    qDeleteAll(mNameToProperty);
    mNameToProperty.clear();

    QMapIterator<QString,QString> it(mObject->properties());
    while (it.hasNext()) {
        it.next();
        QtVariantProperty *property = createProperty(CustomProperty,
                                                     QVariant::String,
                                                     it.key(),
                                                     mCustomPropertiesGroup);
        property->setValue(it.value());
    }

    mUpdating = false;
}
开发者ID:josephbleau,项目名称:tiled,代码行数:19,代码来源:propertybrowser.cpp

示例14: 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;
    }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例15: updateProperties

void ObjectTypesEditor::updateProperties()
{
    const auto selectionModel = mUi->objectTypesTable->selectionModel();
    const auto selectedRows = selectionModel->selectedRows();

    AggregatedProperties aggregatedProperties;

    for (const QModelIndex &index : selectedRows) {
        ObjectType objectType = mObjectTypesModel->objectTypeAt(index);
        aggregatedProperties.aggregate(objectType.defaultProperties);
    }

    mAddPropertyAction->setEnabled(!selectedRows.isEmpty());

    mProperties = aggregatedProperties;

    mUpdating = true;
    mVariantManager->clear();
    mNameToProperty.clear();

    QMapIterator<QString, AggregatedPropertyData> it(aggregatedProperties);
    while (it.hasNext()) {
        it.next();

        const QString &name = it.key();
        const AggregatedPropertyData &data = it.value();

        QtVariantProperty *property = createProperty(data.value().userType(), name);
        property->setValue(data.value());

        bool everywhere = data.presenceCount() == selectedRows.size();
        bool consistent = everywhere && data.valueConsistent();
        if (!everywhere)
            property->setNameColor(Qt::gray);
        if (!consistent)
            property->setValueColor(Qt::gray);
    }

    mUpdating = false;
}
开发者ID:ihuangx,项目名称:tiled,代码行数:40,代码来源:objecttypeseditor.cpp


注:本文中的QtVariantProperty::setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。