PIValueTreeEdit sort attributes according to PIValueTree::standardAttributes
This commit is contained in:
@@ -124,14 +124,23 @@ void PIValueTreeEditParameters::createAttributes(QList<PIVariantEdit *> & list,
|
|||||||
if (!cf && inv_filter) continue;
|
if (!cf && inv_filter) continue;
|
||||||
dal[vit.key()] = vit.value();
|
dal[vit.key()] = vit.value();
|
||||||
}
|
}
|
||||||
|
auto addEdit = [&list, &lay](const QString & name, const PIVariant & value) {
|
||||||
|
auto * ve = new PIVariantEdit();
|
||||||
|
ve->setAttributes(PIVariantEditorBase::editorDefaultAttributes(value.typeID()));
|
||||||
|
ve->setValue(value);
|
||||||
|
ve->setProperty(property_name, name);
|
||||||
|
list << ve;
|
||||||
|
lay->addRow(name + ":", ve);
|
||||||
|
};
|
||||||
|
const auto & sal(PIValueTree::standardAttributes());
|
||||||
|
for (const auto & sn: sal) {
|
||||||
|
if (!dal.contains(sn)) continue;
|
||||||
|
addEdit(PI2QString(sn), dal.value(sn));
|
||||||
|
dal.remove(sn);
|
||||||
|
}
|
||||||
auto dit = dal.makeIterator();
|
auto dit = dal.makeIterator();
|
||||||
while (dit.next()) {
|
while (dit.next()) {
|
||||||
auto * ve = new PIVariantEdit();
|
addEdit(PI2QString(dit.key()), dit.value());
|
||||||
ve->setAttributes(PIVariantEditorBase::editorDefaultAttributes(dit.value().typeID()));
|
|
||||||
ve->setValue(dit.value());
|
|
||||||
ve->setProperty(property_name, PI2QString(dit.key()));
|
|
||||||
list << ve;
|
|
||||||
lay->addRow(PI2QString(dit.key() + ":"), ve);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,10 +195,8 @@ void PIValueTreeEditParameters::on_checkLabel_toggled(bool on) {
|
|||||||
ve_attr.clear();
|
ve_attr.clear();
|
||||||
while (layoutAttributes->rowCount() > 0)
|
while (layoutAttributes->rowCount() > 0)
|
||||||
layoutAttributes->removeRow(0);
|
layoutAttributes->removeRow(0);
|
||||||
createAttributes(ve_attr,
|
// clang-format off
|
||||||
layoutAttributes,
|
createAttributes(ve_attr, layoutAttributes, {{Attribute::style, ""}});
|
||||||
{
|
// clang-format on
|
||||||
{Attribute::style, ""}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user