这篇教程C++ AbstractProperty类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AbstractProperty类的典型用法代码示例。如果您正苦于以下问题:C++ AbstractProperty类的具体用法?C++ AbstractProperty怎么用?C++ AbstractProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了AbstractProperty类的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: applyPropertiesstatic inline void applyProperties(ModelNode &node, const QHash<PropertyName, QVariant> &propertyHash){ QHash<PropertyName, QVariant> auxiliaryData = node.auxiliaryData(); foreach (const PropertyName &propertyName, auxiliaryData.keys()) { if (node.hasAuxiliaryData(propertyName)) node.setAuxiliaryData(propertyName, QVariant()); } QHashIterator<PropertyName, QVariant> propertyIterator(propertyHash); while (propertyIterator.hasNext()) { propertyIterator.next(); const PropertyName propertyName = propertyIterator.key(); if (propertyName == "width" || propertyName == "height") { node.setAuxiliaryData(propertyIterator.key(), propertyIterator.value()); } else if (node.property(propertyIterator.key()).isDynamic() && node.property(propertyIterator.key()).dynamicTypeName() == "alias" && node.property(propertyIterator.key()).isBindingProperty()) { AbstractProperty targetProperty = node.bindingProperty(propertyIterator.key()).resolveToProperty(); if (targetProperty.isValid()) targetProperty.parentModelNode().setAuxiliaryData(targetProperty.name() + "@NodeInstance", propertyIterator.value()); } else { node.setAuxiliaryData(propertyIterator.key() + "@NodeInstance", propertyIterator.value()); } }}
开发者ID:choenig,项目名称:qt-creator,代码行数:26,
示例2: const AbstractProperty * PropertyGroup::findProperty(const std::vector<std::string> & path) const{ // [TODO] Use iterative approach rather than recursion // Check if path is valid if (path.size() == 0) { return nullptr; } // Check if first element of the path exists in this group if (!propertyExists(path.front())) { return nullptr; } // Get the respective property AbstractProperty * property = m_propertiesMap.at(path.front()); // If there are no more sub-paths, return the found property if (path.size() == 1) { return property; } // Otherwise, it is an element in the middle of the path, so ensure it is a group if (!property->isGroup()) { return nullptr; } // Call recursively on subgroup return property->asGroup()->findProperty({ path.begin() + 1, path.end() });}
开发者ID:kateyy,项目名称:libzeug,代码行数:30,
示例3: AbstractProperty::AbstractProperty(const AbstractProperty &property, AbstractView *view) : m_propertyName(property.name()), m_internalNode(property.internalNode()), m_model(property.model()), m_view(view){}
开发者ID:aizaimenghuangu,项目名称:QtTestor,代码行数:8,
示例4: retrievePropertyQWidget * PropertyDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const{ AbstractProperty * property = retrieveProperty(index); if (property->isCollection()) return QStyledItemDelegate::createEditor(parent, option, index); return m_editorFactory->createEditor(*property, parent);}
开发者ID:cginternals,项目名称:libzeug,代码行数:10,
示例5: setStringvoid VariantEditor::setString(const QString & text){ AbstractProperty * prop = dynamic_cast<AbstractProperty *>(m_property); if (prop == nullptr) { return; } prop->fromString(text.toStdString());}
开发者ID:Tobias1595,项目名称:libzeug,代码行数:11,
示例6: getPropertyIcon*CtlMediaObject::getIcon(){ // icon property is a lower resolution thumb nail of the original picture (but should be displayable on a handheld device). // TODO: adapt icon to new media object implementataion AbstractProperty* pProperty = getProperty(AvProperty::ICON); if (pProperty) { return new Icon(0, 0, 0, Mime::IMAGE_JPEG, pProperty->getValue()); } return 0;}
开发者ID:BackupTheBerlios,项目名称:openmm,代码行数:11,
示例7: toVariantVariant PropertyGroup::toVariant() const{ // Create variant map from all properties in the group Variant map = Variant::map(); for (auto it : m_propertiesMap) { // Get name and property std::string name = it.first; AbstractProperty * prop = it.second; // Add to variant map (*map.asMap())[name] = prop->toVariant(); } // Return variant representation return map;}
开发者ID:kateyy,项目名称:libzeug,代码行数:16,
示例8: retrievePropertyvoid PropertyBrowser::expandAllGroups(){ QAbstractItemModel * model = this->model(); QModelIndexList indexes = model->match(model->index(0,0), Qt::DisplayRole, "*", -1, Qt::MatchWildcard|Qt::MatchRecursive); for (QModelIndex index : indexes) { if (!index.isValid()) continue; AbstractProperty * property = retrieveProperty(index); if (property->isGroup() && model->hasChildren(index)) expand(index); }}
开发者ID:Tobias1595,项目名称:libzeug,代码行数:16,
示例9: atvoid AbstractCollection::acceptRecursive(AbstractVisitor * visitor){ // Visit all values of the collection for (size_t i=0; i<count(); i++) { // Get property AbstractProperty * prop = at(i); // Visit property prop->accept(visitor); // If it is a collection, visit collection recursively AbstractCollection * collection = dynamic_cast<AbstractCollection *>(prop); if (collection) { collection->acceptRecursive(visitor); } }}
开发者ID:Tobias1595,项目名称:libzeug,代码行数:17,
示例10: assignvoid PropertyObj::assign(const AbstractProperty& that) { try { *this = dynamic_cast<const PropertyObj&>(that); } catch(const std::bad_cast&) { OPENSIM_THROW(InvalidArgument, "Unsupported type. Expected: " + this->getTypeName() + " | Received: " + that.getTypeName()); }}
开发者ID:antoinefalisse,项目名称:opensim-core,代码行数:9,
示例11: ifQmlDesigner::QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractProperty &property, const QString &textValue){ if (property.isBindingProperty()) { QString val = textValue.trimmed(); if (val.isEmpty()) return QmlDesigner::QmlRefactoring::ObjectBinding; const QChar lastChar = val.at(val.size() - 1); if (lastChar == '}' || lastChar == ';') return QmlDesigner::QmlRefactoring::ObjectBinding; else return QmlDesigner::QmlRefactoring::ScriptBinding; } else if (property.isNodeListProperty()) return QmlDesigner::QmlRefactoring::ArrayBinding; else if (property.isNodeProperty()) return QmlDesigner::QmlRefactoring::ObjectBinding; else if (property.isVariantProperty()) return QmlDesigner::QmlRefactoring::ScriptBinding; Q_ASSERT(!"cannot convert property type"); return (QmlDesigner::QmlRefactoring::PropertyType) -1;}
开发者ID:CNOT,项目名称:julia-studio,代码行数:21,
示例12: detectVerticalCyclebool detectVerticalCycle(const ModelNode &node, QList<ModelNode> knownNodeList){ if (!node.isValid()) return false; if (knownNodeList.contains(node)) return true; knownNodeList.append(node); static QStringList validAnchorLines(QStringList() << "top" << "bottom" << "verticalCenter" << "baseline"); static QStringList anchorNames(QStringList() << "anchors.top" << "anchors.bottom" << "anchors.verticalCenter" << "anchors.baseline"); foreach (const QString &anchorName, anchorNames) { if (node.hasBindingProperty(anchorName)) { AbstractProperty targetProperty = node.bindingProperty(anchorName).resolveToProperty(); if (targetProperty.isValid()) { if (!validAnchorLines.contains(targetProperty.name())) return true; if (detectVerticalCycle(targetProperty.parentModelNode(), knownNodeList)) return true; } } } static QStringList anchorShortcutNames(QStringList() << "anchors.fill" << "anchors.centerIn"); foreach (const QString &anchorName, anchorShortcutNames) { if (node.hasBindingProperty(anchorName)) { ModelNode targetNode = node.bindingProperty(anchorName).resolveToModelNode(); if (targetNode.isValid() && detectVerticalCycle(targetNode, knownNodeList)) return true; } } return false;}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:39,
示例13: addGroupPropertyGroup * PropertyGroup::ensureGroup(const std::vector<std::string> & path){ // [TODO] Use iterative approach rather than recursion // Check if path is valid if (path.size() == 0) { return nullptr; } // Check if group exists PropertyGroup * group = nullptr; if (propertyExists(path.front())) { // Get property AbstractProperty * property = m_propertiesMap.at(path.front()); // Abort if this is not a group if (!property->isGroup()) { return nullptr; } // Get as group group = property->asGroup(); } else { // Add new group group = addGroup(path.front()); } // If there are no more sub-paths, return the group if (path.size() == 1) { return group; } // Otherwise, call recursively on subgroup return group->ensureGroup(std::vector<std::string>(path.begin() + 1, path.end()));}
开发者ID:kateyy,项目名称:libzeug,代码行数:38,
示例14: fromVariantbool PropertyGroup::fromVariant(const Variant & value){ // Check if variant is a map if (!value.isMap()) { return false; } // Get all values from variant map for (auto it : *value.asMap()) { // Get name and value std::string name = it.first; const Variant & var = it.second; // If this names an existing property, set its value AbstractProperty * prop = this->property(name); if (prop) { prop->fromVariant(var); } } // Done return true;}
开发者ID:kateyy,项目名称:libzeug,代码行数:23,
示例15: connectQWidget * VariantEditor::createLineEdit(){ auto lineEdit = new QLineEdit{this}; AbstractProperty * prop = dynamic_cast<AbstractProperty *>(m_property); if (prop == nullptr) { return nullptr; } lineEdit->setText(QString::fromStdString(prop->toString())); connect(lineEdit, &QLineEdit::textEdited, this, &VariantEditor::setString); m_propertyChangedConnection = prop->changed.connect( [this, lineEdit, prop]() { lineEdit->setText(QString::fromStdString(prop->toString())); }); return lineEdit;}
开发者ID:Tobias1595,项目名称:libzeug,代码行数:23,
示例16: detectHorizontalCyclebool detectHorizontalCycle(const ModelNode &node, QList<ModelNode> knownNodeList){ if (knownNodeList.contains(node)) return true; knownNodeList.append(node); static PropertyNameList validAnchorLines(PropertyNameList() << "right" << "left" << "horizontalCenter"); static PropertyNameList anchorNames(PropertyNameList() << "anchors.right" << "anchors.left" << "anchors.horizontalCenter"); foreach (const PropertyName &anchorName, anchorNames) { if (node.hasBindingProperty(anchorName)) { AbstractProperty targetProperty = node.bindingProperty(anchorName).resolveToProperty(); if (targetProperty.isValid()) { if (!validAnchorLines.contains(targetProperty.name())) return true; if (detectHorizontalCycle(targetProperty.parentModelNode(), knownNodeList)) return true; } } } static PropertyNameList anchorShortcutNames(PropertyNameList() << "anchors.fill" << "anchors.centerIn"); foreach (const PropertyName &anchorName, anchorShortcutNames) { if (node.hasBindingProperty(anchorName)) { ModelNode targetNode = node.bindingProperty(anchorName).resolveToModelNode(); if (targetNode.isValid() && detectHorizontalCycle(targetNode, knownNodeList)) return true; } } return false;}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:36,
示例17: QVariantQVariant PropertyModel::data(const QModelIndex & index, int role) const{ if (!index.isValid()) return QVariant(); AbstractProperty * property = retrieveItem(index)->property(); if (role == Qt::DisplayRole && index.column() == 0) { std::string title; if (property->hasOption("title")) title = property->option("title").value<std::string>(); else title = property->name(); return QVariant(QString::fromStdString(title)); } if (role == Qt::ToolTipRole && property->hasOption("tooltip")) return QVariant(QString::fromStdString(property->option("tooltip").value<std::string>())); return QVariant();}
开发者ID:dgimb89,项目名称:libzeug,代码行数:23,
示例18: toQmlQString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDepth) const{ if (property.isBindingProperty()) { return property.toBindingProperty().expression(); } else if (property.isSignalHandlerProperty()) { return property.toSignalHandlerProperty().source(); } else if (property.isNodeProperty()) { return toQml(property.toNodeProperty().modelNode(), indentDepth); } else if (property.isNodeListProperty()) { const QList<ModelNode> nodes = property.toNodeListProperty().toModelNodeList(); if (property.isDefaultProperty()) { QString result; for (int i = 0; i < nodes.length(); ++i) { if (i > 0) result += QLatin1String("/n/n"); result += QString(indentDepth, QLatin1Char(' ')); result += toQml(nodes.at(i), indentDepth); } return result; } else { QString result = QLatin1String("["); const int arrayContentDepth = indentDepth + 4; const QString arrayContentIndentation(arrayContentDepth, QLatin1Char(' ')); for (int i = 0; i < nodes.length(); ++i) { if (i > 0) result += QLatin1Char(','); result += QLatin1Char('/n'); result += arrayContentIndentation; result += toQml(nodes.at(i), arrayContentDepth); } return result + QLatin1Char(']'); } } else if (property.isVariantProperty()) { const VariantProperty variantProperty = property.toVariantProperty(); const QVariant value = variantProperty.value(); const QString stringValue = value.toString(); if (property.name() == "id") return stringValue; if (variantProperty.parentModelNode().metaInfo().isValid() && variantProperty.parentModelNode().metaInfo().propertyIsEnumType(variantProperty.name())) { return variantProperty.parentModelNode().metaInfo().propertyEnumScope(variantProperty.name()) + QLatin1String(".") + stringValue; //Enums do not work with alias properties. This is a workaround. } else if (variantProperty.parentModelNode().metaInfo().isValid() //Enums are not strings && variantProperty.parentModelNode().metaInfo().propertyTypeName(variantProperty.name()) != ("string") && variantProperty.parentModelNode().metaInfo().propertyTypeName(variantProperty.name()) != ("QString") //We check if the value of the property is one of the known Qt Quick enums. && NodeMetaInfo::qtQuickEnumsWithoutScope().contains(stringValue) ) { return NodeMetaInfo::qtQuickEnumScopeForEnumString(stringValue) + QLatin1String(".") + stringValue; } else { switch (value.type()) { case QVariant::Bool: if (value.value<bool>()) return QLatin1String("true"); else return QLatin1String("false"); case QVariant::Color: return QString(QLatin1String("/"%1/"")).arg(properColorName(value.value<QColor>())); case QVariant::Double: return doubleToString(value.toDouble()); case QVariant::Int: case QVariant::LongLong: case QVariant::UInt: case QVariant::ULongLong: return stringValue; default: return QString(QLatin1String("/"%1/"")).arg(escape(stringValue)); } } } else { Q_ASSERT("Unknown property type"); return QString(); }}
开发者ID:kaltsi,项目名称:sailfish-qtcreator,代码行数:84,
示例19: PropertyNameQDebug operator<<(QDebug debug, const AbstractProperty &property){ return debug.nospace() << "AbstractProperty(" << (property.isValid() ? property.name() : PropertyName("invalid")) << ')';}
开发者ID:aizaimenghuangu,项目名称:QtTestor,代码行数:4,
示例20: toQmlQString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDepth) const{ if (property.isBindingProperty()) { return property.toBindingProperty().expression(); } else if (property.isNodeProperty()) { return toQml(property.toNodeProperty().modelNode(), indentDepth); } else if (property.isNodeListProperty()) { const QList<ModelNode> nodes = property.toNodeListProperty().toModelNodeList(); if (property.isDefaultProperty()) { QString result; for (int i = 0; i < nodes.length(); ++i) { if (i > 0) result += QLatin1String("/n/n"); result += QString(indentDepth, QLatin1Char(' ')); result += toQml(nodes.at(i), indentDepth); } return result; } else { QString result = QLatin1String("["); const int arrayContentDepth = indentDepth + 4; const QString arrayContentIndentation(arrayContentDepth, QLatin1Char(' ')); for (int i = 0; i < nodes.length(); ++i) { if (i > 0) result += QLatin1Char(','); result += QLatin1Char('/n'); result += arrayContentIndentation; result += toQml(nodes.at(i), arrayContentDepth); } return result + QLatin1Char(']'); } } else if (property.isVariantProperty()) { const VariantProperty variantProperty = property.toVariantProperty(); const QVariant value = variantProperty.value(); const QString stringValue = value.toString(); if (property.name() == QLatin1String("id")) return stringValue; if (false) { } if (variantProperty.parentModelNode().metaInfo().isValid() && variantProperty.parentModelNode().metaInfo().propertyIsEnumType(variantProperty.name())) { return variantProperty.parentModelNode().metaInfo().propertyEnumScope(variantProperty.name()) + '.' + stringValue; } else { switch (value.type()) { case QVariant::Bool: if (value.value<bool>()) return QLatin1String("true"); else return QLatin1String("false"); case QVariant::Color: return QString(QLatin1String("/"%1/"")).arg(properColorName(value.value<QColor>())); case QVariant::Double: return doubleToString(value.toDouble()); case QVariant::Int: case QVariant::LongLong: case QVariant::UInt: case QVariant::ULongLong: return stringValue; default: return QString(QLatin1String("/"%1/"")).arg(escape(stringValue)); } } } else { Q_ASSERT("Unknown property type"); return QString(); }}
开发者ID:KDE,项目名称:android-qt-creator,代码行数:72,
示例21: compareProperty// TODO: this need to e updated for statesstatic bool compareProperty(const AbstractProperty &property1, const AbstractProperty &property2){ return (property1.name() == property2.name());// && (property1.value().type() == property2.value().type());// && (property1.value() == property2.value()));}
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:7,
示例22: isInHierarchybool ModelToTextMerger::isInHierarchy(const AbstractProperty &property) { return property.isValid() && property.parentModelNode().isInHierarchy();}
开发者ID:CNOT,项目名称:julia-studio,代码行数:3,
注:本文中的AbstractProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AbstractVehicle类代码示例 C++ AbstractNode类代码示例 |