本文整理汇总了C++中QtProperty::subProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ QtProperty::subProperties方法的具体用法?C++ QtProperty::subProperties怎么用?C++ QtProperty::subProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QtProperty
的用法示例。
在下文中一共展示了QtProperty::subProperties方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unFixItem
void IqtFit::unFixItem() {
QtBrowserItem *item = m_ffTree->currentItem();
QtProperty *prop = item->property();
if (prop->subProperties().empty()) {
item = item->parent();
prop = item->property();
}
item->parent()->property()->addSubProperty(m_fixedProps[prop]);
item->parent()->property()->removeSubProperty(prop);
m_fixedProps.remove(prop);
QtProperty *proplbl = prop->subProperties()[0];
delete proplbl;
delete prop;
}
示例2: onMoveLayerUp
/** The move up button was clicked
*/
void QtSpacescapeMainWindow::onMoveLayerUp()
{
// get the selected layer
int layerId = getSelectedLayerId();
if(layerId > -1) {
if(ui->ogreWindow->moveLayerUp(layerId)) {
QList<QtBrowserItem *> bl = ui->layerProperties->topLevelItems();
unsigned int index = bl.size() - layerId - 1;
QtProperty *p = bl[index]->property();
// save expanded settings
bool expanded = ui->layerProperties->isExpanded(bl[index]);
// remove and re-insert at the new location
ui->layerProperties->removeProperty(p);
if(index == 1) {
ui->layerProperties->insertProperty(p, NULL);
}
else {
ui->layerProperties->insertProperty(p,bl[index - 2]->property());
}
// re-apply property tree visiblity settings
bl = ui->layerProperties->topLevelItems();
ui->layerProperties->setExpanded(bl[index - 1],expanded);
// un-expand the color items
QList<QtProperty *> sl = p->subProperties();
for(int i = 0; i < sl.size(); i++) {
if(((QtVariantProperty*)sl[i])->propertyType() == QVariant::Color) {
QList<QtBrowserItem *> bi = ui->layerProperties->items(sl[i]);
ui->layerProperties->setExpanded(bi.first(),false);
}
}
// re-select the item
ui->layerProperties->setFocus();
ui->layerProperties->setCurrentItem(bl[index - 1]);
}
}
}
示例3: shapeChanged
/**
* Slot responding on a change of a masking shape.
*/
void InstrumentWindowMaskTab::shapeChanged()
{
if (!m_left) return; // check that everything is ok
m_userEditing = false; // this prevents resetting shape proeprties by doubleChanged(...)
RectF rect = m_instrWindow->getSurface()->getCurrentBoundingRect();
m_doubleManager->setValue(m_left,rect.x0());
m_doubleManager->setValue(m_top,rect.y1());
m_doubleManager->setValue(m_right,rect.x1());
m_doubleManager->setValue(m_bottom,rect.y0());
for(QMap<QtProperty *,QString>::iterator it = m_doublePropertyMap.begin(); it != m_doublePropertyMap.end(); ++it)
{
m_doubleManager->setValue(it.key(),m_instrWindow->getSurface()->getCurrentDouble(it.value()));
}
for(QMap<QString,QtProperty *>::iterator it = m_pointPropertyMap.begin(); it != m_pointPropertyMap.end(); ++it)
{
QtProperty* prop = it.value();
QList<QtProperty*> subs = prop->subProperties();
if (subs.size() != 2) continue;
QPointF p = m_instrWindow->getSurface()->getCurrentPoint(it.key());
m_doubleManager->setValue(subs[0],p.x());
m_doubleManager->setValue(subs[1],p.y());
}
m_userEditing = true;
}
示例4: 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)));
}
}
示例5: setup_properties
void SchematicSceneBuilder::setup_properties(
Item* item,
std::string name,
double value,
bool symbolic,
std::map<std::string, std::string> props
)
{
QtProperty* properties = SchematicScene::itemProperties(item);
QHash<QString, QtProperty*> subproperties;
if(properties) {
subproperties.insert("__NAME", properties);
foreach(QtProperty* prop, properties->subProperties())
subproperties.insert(prop->propertyName(), prop);
}
if(subproperties.contains("__NAME")) {
QtStringPropertyManager* spm =
qobject_cast<QtStringPropertyManager*>(
subproperties.value("__NAME")->propertyManager());
if(spm)
spm->setValue(
subproperties.value("__NAME"),
QString::fromStdString(name)
);
}
if(subproperties.contains("Value")) {
QtStringPropertyManager* spm =
qobject_cast<QtStringPropertyManager*>(
subproperties.value("Value")->propertyManager());
if(spm)
spm->setValue(
subproperties.value("Value"),
QString::number(value)
);
}
if(subproperties.contains("Symbolic")) {
QtBoolPropertyManager* bpm =
qobject_cast<QtBoolPropertyManager*>(
subproperties.value("Symbolic")->propertyManager());
if(bpm)
bpm->setValue(
subproperties.value("Symbolic"),
symbolic
);
}
if(subproperties.contains("lp:name")) {
QtStringPropertyManager* spm =
qobject_cast<QtStringPropertyManager*>(
subproperties.value("lp:name")->propertyManager());
if(spm)
spm->setValue(
subproperties.value("lp:name"),
QString::fromStdString(props["lp:name"])
);
}
if(subproperties.contains("lp:value")) {
QtStringPropertyManager* spm =
qobject_cast<QtStringPropertyManager*>(
subproperties.value("lp:value")->propertyManager());
if(spm)
spm->setValue(
subproperties.value("lp:value"),
QString::number(
QString::fromStdString(props["lp:value"]).toDouble())
);
}
if(subproperties.contains("ls:name")) {
QtStringPropertyManager* spm =
qobject_cast<QtStringPropertyManager*>(
subproperties.value("ls:name")->propertyManager());
if(spm)
spm->setValue(
subproperties.value("ls:name"),
QString::fromStdString(props["ls:name"])
);
}
if(subproperties.contains("ls:value")) {
QtStringPropertyManager* spm =
qobject_cast<QtStringPropertyManager*>(
subproperties.value("ls:value")->propertyManager());
if(spm)
spm->setValue(
subproperties.value("ls:value"),
QString::number(
QString::fromStdString(props["ls:value"]).toDouble())
);
}
}
示例6: parse_item
void SchematicSceneParser::parse_item(
sapecng::abstract_builder& builder,
Item* item
)
{
SchematicScene::SupportedItemType type = SchematicScene::itemType(item);
std::map<std::string, std::string> props;
storeItemData(props, type, item);
QtProperty* properties = SchematicScene::itemProperties(item);
QHash<QString, QString> subproperties;
if(properties) {
subproperties.insert("__NAME", properties->valueText());
foreach(QtProperty* prop, properties->subProperties())
subproperties.insert(prop->propertyName(), prop->valueText());
}
switch(type)
{
case SchematicScene::GroundItemType:
case SchematicScene::PortItemType:
{
// add as unknow
Component* component = static_cast<Component*>(item);
props["node"] = QString::number(component->nodes().front()).toStdString();
builder.add_unknow_component(props);
break;
}
case SchematicScene::LabelItemType:
{
// add as unknow
Label* label = static_cast<Label*>(item);
props["text"] = label->text().toStdString();
builder.add_unknow_component(props);
break;
}
case SchematicScene::WireItemType:
{
Wire* wire = static_cast<Wire*>(item);
props["orientation"] =
QString::number(wire->orientation()).toStdString();
props["to_x"] =
QString::number(wire->toPoint().x()).toStdString();
props["to_y"] =
QString::number(wire->toPoint().y()).toStdString();
props["conn"] =
QString::number(wire->isJunctionsConnected()).toStdString();
builder.add_wire_component(props);
break;
}
case SchematicScene::OutItemType:
{
if(!discard_) {
Component* out = static_cast<Component*>(item);
builder.add_out_component(out->nodes().front(), props);
}
break;
}
case SchematicScene::VoltmeterItemType:
case SchematicScene::AmmeterItemType:
{
Component* component = static_cast<Component*>(item);
QVector<int> nodes = component->nodes();
builder.add_dual_component(
dualMap_[type], "", 1., true,
nodes.at(1), nodes.at(0),
props
);
break;
}
case SchematicScene::CapacitorItemType:
case SchematicScene::ConductanceItemType:
case SchematicScene::InductorItemType:
case SchematicScene::ResistorItemType:
case SchematicScene::CurrentSourceItemType:
case SchematicScene::VoltageSourceItemType:
{
Component* component = static_cast<Component*>(item);
QVector<int> nodes = component->nodes();
storeLabel(props, component);
builder.add_dual_component(
dualMap_[type], subproperties.value("__NAME").toStdString(),
subproperties.value("Value").toDouble(),
QVariant(subproperties.value("Symbolic")).toBool(),
nodes.at(1), nodes.at(0),
props
);
//.........这里部分代码省略.........