本文整理汇总了C++中MarSystem::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ MarSystem::getParent方法的具体用法?C++ MarSystem::getParent怎么用?C++ MarSystem::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarSystem
的用法示例。
在下文中一共展示了MarSystem::getParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createItem
void MarSystemView::createItem( MarSystem *system, QQmlComponent * delegate, QQuickItem * parent )
{
int level = -1;
MarSystem *s = system;
while(s) {
s = s->getParent();
++level;
}
QQmlPropertyMap *data = new QQmlPropertyMap;
data->insert("level", level);
// Get controls
QQmlPropertyMap *defaultControls = new QQmlPropertyMap;
defaultControls->insert("inSamples", variantFromControl(system->getControl("mrs_natural/inSamples")));
defaultControls->insert("onSamples", variantFromControl(system->getControl("mrs_natural/onSamples")));
defaultControls->insert("inObservations", variantFromControl(system->getControl("mrs_natural/inObservations")));
defaultControls->insert("onObservations", variantFromControl(system->getControl("mrs_natural/onObservations")));
defaultControls->insert("israte", variantFromControl(system->getControl("mrs_real/israte")));
defaultControls->insert("osrate", variantFromControl(system->getControl("mrs_real/osrate")));
defaultControls->insert("inStabilizingDelay", variantFromControl(system->getControl("mrs_natural/inStabilizingDelay")));
defaultControls->insert("onStabilizingDelay", variantFromControl(system->getControl("mrs_natural/onStabilizingDelay")));
defaultControls->insert("inObsNames", variantFromControl(system->getControl("mrs_string/inObsNames")));
defaultControls->insert("onObsNames", variantFromControl(system->getControl("mrs_string/onObsNames")));
defaultControls->insert("active", variantFromControl(system->getControl("mrs_bool/active")));
defaultControls->insert("mute", variantFromControl(system->getControl("mrs_bool/mute")));
defaultControls->insert("debug", variantFromControl(system->getControl("mrs_bool/debug")));
defaultControls->insert("verbose", variantFromControl(system->getControl("mrs_bool/verbose")));
defaultControls->insert("processedData", variantFromControl(system->getControl("mrs_realvec/processedData")));
QQmlPropertyMap *customControls = new QQmlPropertyMap;
control_map_t controls = system->controls();
control_map_t::iterator it;
for (it = controls.begin(); it != controls.end(); ++it)
{
const MarControlPtr & control = it->second;
QString name = QString::fromStdString( control->getName() );
name = name.split('/').last();
if (defaultControls->contains(name))
continue;
customControls->insert(name, variantFromControl(control));
}
data->insert("defaultControls", QVariant::fromValue<QObject*>(defaultControls));
data->insert("controls", QVariant::fromValue<QObject*>(customControls));
data->insert("absolutePath", QString::fromStdString(system->getAbsPath()));
data->insert("path", QString::fromStdString(system->getPrefix()));
// Set context
QQmlContext *context = new QQmlContext( delegate->creationContext() );
context->setContextProperty("system", data);
QObject *object = delegate->create(context);
object->setParent(parent);
m_items.append(object);
QQuickItem *item = qobject_cast<QQuickItem*>(object);
if (!item)
return;
QString path = QString::fromStdString(system->getPrefix());
std::vector<MarSystem*> children = system->getChildren();
int children_count = children.size();
bool has_children = children_count > 0;
bool create_if_not_existent = true;
MarSystemViewAttached *attached =
qobject_cast<MarSystemViewAttached*>(qmlAttachedPropertiesObject<MarSystemView>(item, create_if_not_existent) );
Q_ASSERT(attached);
attached->setPath(path);
attached->setHasChildren(has_children);
attached->setSystem(system);
QQuickItem *children_area = attached->childrenArea();
if (!children_area)
children_area = item;
for (int child_idx = 0; child_idx < children_count; ++child_idx)
{
MarSystem *child_system = children[child_idx];
createItem(child_system, delegate, children_area);
}
item->setParentItem(parent);
}