本文整理汇总了C++中QtVariantProperty::subProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ QtVariantProperty::subProperties方法的具体用法?C++ QtVariantProperty::subProperties怎么用?C++ QtVariantProperty::subProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QtVariantProperty
的用法示例。
在下文中一共展示了QtVariantProperty::subProperties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAudioUnit
void AudioUnitPropertiesWindow::setAudioUnit(AudioUnit *pAudioUnit)
{
Q_ASSERT(pAudioUnit != nullptr);
QtVariantPropertyManager *pPropertyManager = pAudioUnit->propertyManager();
QtVariantProperty *pRootProperty = pAudioUnit->rootProperty();
QList<QtProperty*> subProperties = pRootProperty->subProperties();
for (QtProperty *pProperty : subProperties) {
m_pPropertyBrowser->addProperty(pProperty);
}
m_pPropertyBrowser->setFactoryForManager(pPropertyManager, m_pPropertyFactory);
m_pPropertyBrowser->setPropertiesWithoutValueMarked(true);
m_pPropertyBrowser->setRootIsDecorated(false);
m_pPropertyBrowser->setAlternatingRowColors(true);
m_pPropertyBrowser->setResizeMode(QtTreePropertyBrowser::Interactive);
setWindowTitle(tr("Properties of '%1'").arg(pAudioUnit->plugin()->name()));
}
示例2: setObject
//.........这里部分代码省略.........
const PropertySheetFlagValue f = qvariant_cast<PropertySheetFlagValue>(value);
QList<QPair<QString, uint> > flags;
QStringListIterator it(f.metaFlags.keys());
while (it.hasNext()) {
const QString name = it.next();
const uint val = f.metaFlags.keyToValue(name);
flags.append(qMakePair(name, val));
}
m_updatingBrowser = true;
QVariant v;
qVariantSetValue(v, flags);
property->setAttribute(m_strings.m_flagsAttribute, v);
m_updatingBrowser = false;
}
}
}
if (property != 0) {
const bool dynamicProperty = (dynamicSheet && dynamicSheet->isDynamicProperty(i))
|| (sheet && sheet->isDefaultDynamicProperty(i));
switch (type) {
case QVariant::Palette:
setupPaletteProperty(property);
break;
case QVariant::KeySequence:
//addCommentProperty(property, propertyName);
break;
default:
break;
}
if (type == QVariant::String || type == qMetaTypeId<PropertySheetStringValue>())
setupStringProperty(property, isMainContainer);
property->setAttribute(m_strings.m_resettableAttribute, m_propertySheet->hasReset(i));
const QString groupName = m_propertySheet->propertyGroup(i);
QtVariantProperty *groupProperty = 0;
if (newProperty) {
QMap<QString, QtVariantProperty*>::const_iterator itPrev = m_nameToProperty.insert(propertyName, property);
m_propertyToGroup[property] = groupName;
if (m_sorting) {
QtProperty *previous = 0;
if (itPrev != m_nameToProperty.constBegin())
previous = (--itPrev).value();
m_currentBrowser->insertProperty(property, previous);
}
}
const QMap<QString, QtVariantProperty*>::const_iterator gnit = m_nameToGroup.constFind(groupName);
if (gnit != m_nameToGroup.constEnd()) {
groupProperty = gnit.value();
} else {
groupProperty = m_propertyManager->addProperty(QtVariantPropertyManager::groupTypeId(), groupName);
QtBrowserItem *item = 0;
if (!m_sorting)
item = m_currentBrowser->insertProperty(groupProperty, lastGroup);
m_nameToGroup[groupName] = groupProperty;
m_groups.append(groupProperty);
if (dynamicProperty)
m_dynamicGroup = groupProperty;
if (m_currentBrowser == m_treeBrowser && item) {
m_treeBrowser->setBackgroundColor(item, propertyColor(groupProperty));
groupProperty->setModified(true);
}
}
/* Group changed or new group. Append to last subproperty of
* that group. Note that there are cases in which a derived
* property sheet appends fake properties for the class
* which will appear after the layout group properties
* (QWizardPage). To make them appear at the end of the
* actual class group, goto last element. */
if (lastGroup != groupProperty) {
lastGroup = groupProperty;
lastProperty = 0; // Append at end
const QList<QtProperty*> subProperties = lastGroup->subProperties();
if (!subProperties.empty())
lastProperty = subProperties.back();
lastGroup = groupProperty;
}
if (!m_groups.contains(groupProperty))
m_groups.append(groupProperty);
if (newProperty)
groupProperty->insertSubProperty(property, lastProperty);
lastProperty = property;
updateBrowserValue(property, value);
property->setModified(m_propertySheet->isChanged(i));
if (propertyName == QLatin1String("geometry") && type == QVariant::Rect) {
QList<QtProperty *> subProperties = property->subProperties();
foreach (QtProperty *subProperty, subProperties) {
const QString subPropertyName = subProperty->propertyName();
if (subPropertyName == QLatin1String("X") || subPropertyName == QLatin1String("Y"))
subProperty->setEnabled(!isMainContainer);
}
}
} else {
qWarning("%s", qPrintable(msgUnsupportedType(propertyName, type)));
}
}