当前位置: 首页>>代码示例>>C++>>正文


C++ QtProperty::addSubProperty方法代码示例

本文整理汇总了C++中QtProperty::addSubProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QtProperty::addSubProperty方法的具体用法?C++ QtProperty::addSubProperty怎么用?C++ QtProperty::addSubProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QtProperty的用法示例。


在下文中一共展示了QtProperty::addSubProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setProperties

void InstrumentWidgetMaskTab::setProperties() {
  clearProperties();
  m_userEditing = false;

  // bounding rect property
  QtProperty *boundingRectGroup = m_groupManager->addProperty("Bounding Rect");
  m_browser->addProperty(boundingRectGroup);
  m_left = addDoubleProperty("left");
  m_top = addDoubleProperty("top");
  m_right = addDoubleProperty("right");
  m_bottom = addDoubleProperty("bottom");
  boundingRectGroup->addSubProperty(m_left);
  boundingRectGroup->addSubProperty(m_top);
  boundingRectGroup->addSubProperty(m_right);
  boundingRectGroup->addSubProperty(m_bottom);

  // point properties
  QStringList pointProperties =
      m_instrWidget->getSurface()->getCurrentPointNames();
  foreach (QString name, pointProperties) {
    QtProperty *point = m_groupManager->addProperty(name);
    QtProperty *prop_x = addDoubleProperty("x");
    QtProperty *prop_y = addDoubleProperty("y");
    point->addSubProperty(prop_x);
    point->addSubProperty(prop_y);
    m_browser->addProperty(point);
    m_pointComponentsMap[prop_x] = name;
    m_pointComponentsMap[prop_y] = name;
    m_pointPropertyMap[name] = point;
  }
开发者ID:samueljackson92,项目名称:mantid,代码行数:30,代码来源:InstrumentWidgetMaskTab.cpp

示例2: QString

QtProperty *CrossCommonPropertyGroup::extrackViewProperty(QtVariantPropertyManager *manager,
                                                          QHash<QString, QtVariantProperty *> &propertyTable)
{
    QtProperty          *parameters;
    QtVariantProperty   *item;

    parameters = manager->addProperty(QtVariantPropertyManager::groupTypeId(),
                                      QString(QObject::tr("外观属性")));

    item = manager->addProperty(QVariant::Color, QString(QObject::tr("背景颜色")));
    item->setValue(QColor(0, 0, 0, 255));
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/view/backgroud_color", item);

    item = manager->addProperty(QVariant::Color, QString(QObject::tr("边框颜色")));
    item->setValue(QColor(0, 0, 0, 255));
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/view/border_color", item);

    item = manager->addProperty(QVariant::Double, QString(QObject::tr("边框宽度")));
    item->setValue(1);
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/view/border_line_width", item);

    return parameters;
}
开发者ID:yujiajia,项目名称:Just-Go,代码行数:26,代码来源:cross_common_property_group.cpp

示例3: insertLayerProperties

/** Utility function for creating and inserting layer properties
@param layer Spacescape layer
@param insertAfter Property to insert after
@param minimize Minimize this layer
@return The created / inserted property
*/
QtProperty* QtSpacescapeMainWindow::insertLayerProperties(Ogre::SpacescapeLayer* layer, QtProperty *insertAfter, bool minimize)
{
    // turn refreshing flag on so we don't process valueChanged events
    mRefreshing = true;

    // get layer params
    Ogre::NameValuePairList params = layer->getParams();

    // create the layer properties object
    QtProperty *layerProperties = mPropertyManager->addProperty(
                QtVariantPropertyManager::groupTypeId(),
                QLatin1String(layer->getName().c_str())
    );

    // insert it into the property tree early so we can minize items inside
    ui->layerProperties->insertProperty(layerProperties, insertAfter);

    // minimize the layer - speeds things up!
    if(minimize) {
        ui->layerProperties->setExpanded(ui->layerProperties->topLevelItem(layerProperties), false);
    }

    // add the common layer params to the subproperties first
    layerProperties->addSubProperty(createProperty( "name", layer->getName()));
    layerProperties->addSubProperty(createProperty( "type", layer->getLayerTypeName()));
    layerProperties->addSubProperty(createProperty( "visible", "true"));
    layerProperties->addSubProperty(createProperty( "seed", params["seed"]));

    // now add all the remaining layer params to the subproperties
    Ogre::NameValuePairList::iterator pl;
    for(pl = params.begin(); pl != params.end(); pl++) {
        // skip common params that come first
        if(pl->first == "name" || pl->first == "type" || 
            pl->first == "visible" || pl->first == "seed") {
            continue;
        }

        // create the sub property
        QtVariantProperty* subProperty = createProperty(pl->first, pl->second);
        if(!subProperty) {
            continue;
        }

        // add this sub property parameter
        layerProperties->addSubProperty(subProperty);

        // special auto hide for color types
        if(getPropertyType(pl->first) == QVariant::Color) {
            QList<QtBrowserItem *> bi = ui->layerProperties->items(subProperty);
            ui->layerProperties->setExpanded(bi.first(),false);
        }
    }

    // done adding properties
    mRefreshing = false;

    return layerProperties;
}
开发者ID:svenstaro,项目名称:Spacescape,代码行数:64,代码来源:QtSpacescapeMainWindow.cpp

示例4:

QtProperty *IqtFit::createExponential(const QString &name) {
  QtProperty *expGroup = m_grpManager->addProperty(name);
  m_properties[name + ".Intensity"] = m_dblManager->addProperty("Intensity");
  m_dblManager->setDecimals(m_properties[name + ".Intensity"], NUM_DECIMALS);
  m_properties[name + ".Tau"] = m_dblManager->addProperty("Tau");
  m_dblManager->setDecimals(m_properties[name + ".Tau"], NUM_DECIMALS);
  expGroup->addSubProperty(m_properties[name + ".Intensity"]);
  expGroup->addSubProperty(m_properties[name + ".Tau"]);
  return expGroup;
}
开发者ID:dezed,项目名称:mantid,代码行数:10,代码来源:IqtFit.cpp

示例5: fixItem

void IqtFit::fixItem() {
  QtBrowserItem *item = m_ffTree->currentItem();

  // Determine what the property is.
  QtProperty *prop = item->property();

  QtProperty *fixedProp = m_stringManager->addProperty(prop->propertyName());
  QtProperty *fprlbl = m_stringManager->addProperty("Fixed");
  fixedProp->addSubProperty(fprlbl);
  m_stringManager->setValue(fixedProp, prop->valueText());

  item->parent()->property()->addSubProperty(fixedProp);
  m_fixedProps[fixedProp] = prop;
  item->parent()->property()->removeSubProperty(prop);
}
开发者ID:dezed,项目名称:mantid,代码行数:15,代码来源:IqtFit.cpp

示例6: main

int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    QtVariantPropertyManager *variantManager = new QtVariantPropertyManager();

    int i = 0;
    QtProperty *topItem = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
                QString::number(i++) + QLatin1String(" Group Property"));

    QtVariantProperty *item = variantManager->addProperty(QVariant::Bool, QString::number(i++) + QLatin1String(" Bool Property"));
    item->setValue(true);
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Int, QString::number(i++) + QLatin1String(" Int Property"));
    item->setValue(20);
    item->setAttribute(QLatin1String("minimum"), 0);
    item->setAttribute(QLatin1String("maximum"), 100);
    item->setAttribute(QLatin1String("singleStep"), 10);
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Double, QString::number(i++) + QLatin1String(" Double Property"));
    item->setValue(1.2345);
    item->setAttribute(QLatin1String("singleStep"), 0.1);
    item->setAttribute(QLatin1String("decimals"), 3);
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property"));
    item->setValue("Value");
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Date, QString::number(i++) + QLatin1String(" Date Property"));
    item->setValue(QDate::currentDate().addDays(2));
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Time, QString::number(i++) + QLatin1String(" Time Property"));
    item->setValue(QTime::currentTime());
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::DateTime, QString::number(i++) + QLatin1String(" DateTime Property"));
    item->setValue(QDateTime::currentDateTime());
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::KeySequence, QString::number(i++) + QLatin1String(" KeySequence Property"));
    item->setValue(QKeySequence(Qt::ControlModifier | Qt::Key_Q));
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Char, QString::number(i++) + QLatin1String(" Char Property"));
    item->setValue(QChar(386));
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Locale, QString::number(i++) + QLatin1String(" Locale Property"));
    item->setValue(QLocale(QLocale::Polish, QLocale::Poland));
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Point, QString::number(i++) + QLatin1String(" Point Property"));
    item->setValue(QPoint(10, 10));
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::PointF, QString::number(i++) + QLatin1String(" PointF Property"));
    item->setValue(QPointF(1.2345, -1.23451));
    item->setAttribute(QLatin1String("decimals"), 3);
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Size, QString::number(i++) + QLatin1String(" Size Property"));
    item->setValue(QSize(20, 20));
    item->setAttribute(QLatin1String("minimum"), QSize(10, 10));
    item->setAttribute(QLatin1String("maximum"), QSize(30, 30));
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::SizeF, QString::number(i++) + QLatin1String(" SizeF Property"));
    item->setValue(QSizeF(1.2345, 1.2345));
    item->setAttribute(QLatin1String("decimals"), 3);
    item->setAttribute(QLatin1String("minimum"), QSizeF(0.12, 0.34));
    item->setAttribute(QLatin1String("maximum"), QSizeF(20.56, 20.78));
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QVariant::Rect, QString::number(i++) + QLatin1String(" Rect Property"));
    item->setValue(QRect(10, 10, 20, 20));
    topItem->addSubProperty(item);
    item->setAttribute(QLatin1String("constraint"), QRect(0, 0, 50, 50));

    item = variantManager->addProperty(QVariant::RectF, QString::number(i++) + QLatin1String(" RectF Property"));
    item->setValue(QRectF(1.2345, 1.2345, 1.2345, 1.2345));
    topItem->addSubProperty(item);
    item->setAttribute(QLatin1String("constraint"), QRectF(0, 0, 50, 50));
    item->setAttribute(QLatin1String("decimals"), 3);

    item = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),
                    QString::number(i++) + QLatin1String(" Enum Property"));
    QStringList enumNames;
    enumNames << "Enum0" << "Enum1" << "Enum2";
    item->setAttribute(QLatin1String("enumNames"), enumNames);
    item->setValue(1);
    topItem->addSubProperty(item);

    item = variantManager->addProperty(QtVariantPropertyManager::flagTypeId(),
                    QString::number(i++) + QLatin1String(" Flag Property"));
    QStringList flagNames;
    flagNames << "Flag0" << "Flag1" << "Flag2";
//.........这里部分代码省略.........
开发者ID:Felipeasg,项目名称:QtPropertyBrowser,代码行数:101,代码来源:main.cpp

示例7: addClassProperties

void ObjectControllerPrivate::addClassProperties(const QMetaObject *metaObject)
{
    if (!metaObject)
        return;

    addClassProperties(metaObject->superClass());

    QtProperty *classProperty = m_classToProperty.value(metaObject);
    if (!classProperty) {
        QString className = QLatin1String(metaObject->className());
        classProperty = m_manager->addProperty(QtVariantPropertyManager::groupTypeId(), className);
        m_classToProperty[metaObject] = classProperty;
        m_propertyToClass[classProperty] = metaObject;

        for (int idx = metaObject->propertyOffset(); idx < metaObject->propertyCount(); idx++) {
            QMetaProperty metaProperty = metaObject->property(idx);
            int type = metaProperty.userType();
            QtVariantProperty *subProperty = 0;
            if (!metaProperty.isReadable()) {
                subProperty = m_readOnlyManager->addProperty(QVariant::String, QLatin1String(metaProperty.name()));
                subProperty->setValue(QLatin1String("< Non Readable >"));
            } else if (metaProperty.isEnumType()) {
                if (metaProperty.isFlagType()) {
                    subProperty = m_manager->addProperty(QtVariantPropertyManager::flagTypeId(), QLatin1String(metaProperty.name()));
                    QMetaEnum metaEnum = metaProperty.enumerator();
                    QMap<int, bool> valueMap;
                    QStringList flagNames;
                    for (int i = 0; i < metaEnum.keyCount(); i++) {
                        int value = metaEnum.value(i);
                        if (!valueMap.contains(value) && isPowerOf2(value)) {
                            valueMap[value] = true;
                            flagNames.append(QLatin1String(metaEnum.key(i)));
                        }
                    subProperty->setAttribute(QLatin1String("flagNames"), flagNames);
                    subProperty->setValue(flagToInt(metaEnum, metaProperty.read(m_object).toInt()));
                    }
                } else {
                    subProperty = m_manager->addProperty(QtVariantPropertyManager::enumTypeId(), QLatin1String(metaProperty.name()));
                    QMetaEnum metaEnum = metaProperty.enumerator();
                    QMap<int, bool> valueMap; // dont show multiple enum values which have the same values
                    QStringList enumNames;
                    for (int i = 0; i < metaEnum.keyCount(); i++) {
                        int value = metaEnum.value(i);
                        if (!valueMap.contains(value)) {
                            valueMap[value] = true;
                            enumNames.append(QLatin1String(metaEnum.key(i)));
                        }
                    }
                    subProperty->setAttribute(QLatin1String("enumNames"), enumNames);
                    subProperty->setValue(enumToInt(metaEnum, metaProperty.read(m_object).toInt()));
                }
            } else if (m_manager->isPropertyTypeSupported(type)) {
                if (!metaProperty.isWritable())
                    subProperty = m_readOnlyManager->addProperty(type, QLatin1String(metaProperty.name()) + QLatin1String(" (Non Writable)"));
                if (!metaProperty.isDesignable())
                    subProperty = m_readOnlyManager->addProperty(type, QLatin1String(metaProperty.name()) + QLatin1String(" (Non Designable)"));
                else
                    subProperty = m_manager->addProperty(type, QLatin1String(metaProperty.name()));
                subProperty->setValue(metaProperty.read(m_object));
            } else {
                subProperty = m_readOnlyManager->addProperty(QVariant::String, QLatin1String(metaProperty.name()));
                subProperty->setValue(QLatin1String("< Unknown Type >"));
                subProperty->setEnabled(false);
            }
            classProperty->addSubProperty(subProperty);
            m_propertyToIndex[subProperty] = idx;
            m_classToIndexToProperty[metaObject][idx] = subProperty;
        }
    } else {
        updateClassProperties(metaObject, false);
    }

    m_topLevelProperties.append(classProperty);
    m_browser->addProperty(classProperty);
}
开发者ID:Elv13,项目名称:Kimberlite,代码行数:75,代码来源:objectcontroller.cpp

示例8: addClassProperties


//.........这里部分代码省略.........

                // Note:  Get the var member name and check if we want it to be writable (Enabled)
                QString memberVarName = QLatin1String(metaProperty.name());
                bool b_SetEnabled = true;

                // Special case for enabling or disabling editing
                QString ememberVarName = "e" + QLatin1String(metaProperty.name());
                QByteArray array = ememberVarName.toLocal8Bit();
                char* buffer = array.data();
                QVariant set = m_object->property(buffer);
                if (set.type() == QVariant::Bool)
                {
                    b_SetEnabled = (bool &)set;
                }

                // qDebug() << "Member Name :" << memberVarName;

                // Note: process the first char if it contains _ then the var is read only and remove the _ char
                if (memberVarName.at(0) == "_") {
                    b_SetEnabled = false;
                    memberVarName.remove(0, 1);
                }

                // after that replace all occurance of _ with space char for display 
                memberVarName.replace(QString("_"), QString(" "));

                if (!metaProperty.isReadable()) {
                    subProperty = m_readOnlyManager->addProperty(QVariant::String, memberVarName);
                    subProperty->setValue(QLatin1String("< Non Readable >"));
                }
                else if (metaProperty.isEnumType()) {
                    if (metaProperty.isFlagType()) {
                        subProperty = m_manager->addProperty(QtVariantPropertyManager::flagTypeId(), memberVarName);
                        QMetaEnum metaEnum = metaProperty.enumerator();
                        QMap<int, bool> valueMap;
                        QStringList flagNames;
                        for (int i = 0; i < metaEnum.keyCount(); i++) {
                            int value = metaEnum.value(i);
                            if (!valueMap.contains(value) && isPowerOf2(value)) {
                                valueMap[value] = true;
                                flagNames.append(QLatin1String(metaEnum.key(i)));
                            }
                            subProperty->setAttribute(QLatin1String("flagNames"), flagNames);
                            subProperty->setValue(flagToInt(metaEnum, metaProperty.read(m_object).toInt()));
                        }
                    }
                    else {
                        subProperty = m_manager->addProperty(QtVariantPropertyManager::enumTypeId(), memberVarName);
                        QMetaEnum metaEnum = metaProperty.enumerator();
                        QMap<int, bool> valueMap; // dont show multiple enum values which have the same values
                        QStringList enumNames;
                        for (int i = 0; i < metaEnum.keyCount(); i++) {
                            int value = metaEnum.value(i);
                            if (!valueMap.contains(value)) {
                                valueMap[value] = true;
                                enumNames.append(QLatin1String(metaEnum.key(i)));
                            }
                        }
                        subProperty->setAttribute(QLatin1String("enumNames"), enumNames);
                        subProperty->setValue(enumToInt(metaEnum, metaProperty.read(m_object).toInt()));
                    }
                }
                else if (m_manager->isPropertyTypeSupported(type)) {
                    if (!metaProperty.isWritable())
                        subProperty = m_readOnlyManager->addProperty(type, memberVarName + QLatin1String(" (Non Writable)"));
                    if (!metaProperty.isDesignable())
                        subProperty = m_readOnlyManager->addProperty(type, memberVarName + QLatin1String(" (Non Designable)"));
                    else
                        subProperty = m_manager->addProperty(type, memberVarName);
                    subProperty->setValue(metaProperty.read(m_object));
                }
                else {
                    subProperty = m_readOnlyManager->addProperty(QVariant::String, memberVarName);
                    subProperty->setValue(QLatin1String("< Unknown Type >"));
                    b_SetEnabled = false;
                }


                // Notes: QtVariantProperty *priority = variantManager->addProperty(QVariant::Int, "Priority");	

                if (subProperty)
                    subProperty->setEnabled(b_SetEnabled);

                m_propertyToIndex[subProperty] = idx;
                m_classToIndexToProperty[metaObject][idx] = subProperty;
                if (subGroup)
                    classProperty->addSubProperty(subProperty);
                else
                    m_browser->addProperty(subProperty);
            }
        }
        else {
            updateClassProperties(metaObject, false);
        }

        m_topLevelProperties.append(classProperty);
        if (subGroup)
            m_browser->addProperty(classProperty);
    } // Loop i
}
开发者ID:KTXSoftware,项目名称:Compressonator,代码行数:101,代码来源:objectcontroller.cpp

示例9: initPropertyView

void PropertiesMgr::initPropertyView()
{

	QtTreePropertyBrowser * tb = (QtTreePropertyBrowser*)ViewMgr::getInstance()->getWidgetWithName("propertiesWidget");
	tb->clear();

	if (m_variantManager == nullptr)
		m_variantManager = new QtVariantPropertyManager();
	else
		disconnect(m_variantManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)), this, SLOT(propertyValueChanged(QtProperty *, const QVariant &)));
	m_variantManager->clear();
	m_particlesSlotProperty.clear();
	m_spineActionNames.clear();
	m_slotsNames.clear();
	QtProperty * actionGroup = m_variantManager->addProperty(QtVariantPropertyManager::groupTypeId(), tr("action properties"));

	m_actionNameProperty = m_variantManager->addProperty(QtVariantPropertyManager::enumTypeId(), "actionName:");
	QStringList spineActionName;
	spineActionName << "";
	m_spineActionNames.push_back("");
	spine::SkeletonAnimation * pSkeleton = DocumentMgr::getInstance()->m_pSpineParticle->m_skeleton;
	for (int i = 0; i < pSkeleton->getSkeleton()->data->animationsCount; ++i)
	{
		spineActionName << pSkeleton->getSkeleton()->data->animations[i]->name;
		m_spineActionNames.push_back(pSkeleton->getSkeleton()->data->animations[i]->name);
	}
	m_actionNameProperty->setAttribute(QLatin1String("enumNames"), spineActionName);
	actionGroup->addSubProperty(m_actionNameProperty);
	int pos = 0;
	if (DocumentMgr::getInstance()->m_currentAction)
	for (auto it : m_spineActionNames)
	{
		if (DocumentMgr::getInstance()->m_currentAction->spineActionName == it)
		{
			m_actionNameProperty->setValue(pos);
			break;
		}
		pos++;
	}
	QtProperty *particleGroup = m_variantManager->addProperty(QtVariantPropertyManager::groupTypeId(), tr("particle properties"));

	QStringList slotsName;
	slotsName << "none";
	m_slotsNames.push_back("none");
	for (int i = 0; i < pSkeleton->getSkeleton()->data->slotsCount; i++)
	{
		slotsName << pSkeleton->getSkeleton()->data->spineSlots[i]->name;
		m_slotsNames.push_back(pSkeleton->getSkeleton()->data->spineSlots[i]->name);
	}

	for (auto & it : DocumentMgr::getInstance()->m_pSpineParticle->m_particles)
	{
		QtProperty *particleinfoGroup = m_variantManager->addProperty(QtVariantPropertyManager::groupTypeId(), it.first.c_str());
		auto particleProperty = m_variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),"slot");

		particleProperty->setAttribute(QLatin1String("enumNames"), slotsName);
		particleinfoGroup->addSubProperty(particleProperty);
		m_particlesSlotProperty.insert(std::make_pair(particleProperty, it.first));
		if (DocumentMgr::getInstance()->m_currentAction)
		{
			auto &slotsData = DocumentMgr::getInstance()->m_currentAction->slotsData;
			auto p = slotsData.find(it.first);
			if (p != slotsData.end())
			{
				int index = 0;
				for (auto &name : m_slotsNames)
				{
					if (name == p->second.slotsName)
					{
						particleProperty->setValue(index);
						break;
					}
						
					index++;
				}
			}
		}

		auto offsetProperty = m_variantManager->addProperty(QVariant::PointF, tr("offset:"));
		offsetProperty->setAttribute(QLatin1String("decimals"), 2);
		if (DocumentMgr::getInstance()->m_currentAction)
		{
			auto &slotsData = DocumentMgr::getInstance()->m_currentAction->slotsData;
			auto p = slotsData.find(it.first);
			if (p != slotsData.end())
			{
				offsetProperty->setValue(QPointF(p->second.offset.x, p->second.offset.y));
			}
		}

		particleinfoGroup->addSubProperty(offsetProperty);
		m_particleOffsetProperty.insert(std::make_pair(offsetProperty, it.first));
		particleGroup->addSubProperty(particleinfoGroup);
	}
	QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory();

	tb->setFactoryForManager(m_variantManager, variantFactory);

	tb->addProperty(actionGroup);
	tb->addProperty(particleGroup);
//.........这里部分代码省略.........
开发者ID:enhhh,项目名称:cocos-tool-with-qt-demo,代码行数:101,代码来源:PropertiesMgr.cpp

示例10: show

void CPropBrowserEngineGeneral::show(QWidget* parentWindow)
{
	setPropertiesWithoutValueMarked(true); // so that group properties stand out
	setRootIsDecorated(true); // keep true, otherwise subcategories won't work correctly
	setAlternatingRowColors(true);
	setHeaderVisible(true);
	//setIndentation(60);
	//setStatusTip("bla");
	//setToolTip("Bla");
	setResizeMode(QtTreePropertyBrowser::Interactive);
	setSplitterPosition(_splitterPos);
	setWindowTitle("Physics Engines Properties - General");


	variantManager = new QtVariantPropertyManager();
	variantFactory = new QtVariantEditorFactory();
	setFactoryForManager(variantManager,variantFactory);


	buttonManager = new ButtonEditManager();
	buttonFactory  = new PushButtonEditFactory();
	setFactoryForManager(buttonManager,buttonFactory);


	QStringList configurationEnum;
	configurationEnum << "Very accurate" << "Accurate (default)" << "Fast" << "Very fast" << "Customized";
	p_configuration = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),"");
	p_configuration->setAttribute("enumNames", configurationEnum);
	QtBrowserItem* anItem=addProperty(p_configuration);
	setBackgroundColor(anItem,QTPROPERTYBROWSER_COLOR_GREY);


	QtProperty *bulletGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Bullet properties");
	bulletGroup->theBrightness=140;
	bulletGroupItem=addProperty(bulletGroup);
	setBackgroundColor(bulletGroupItem,QTPROPERTYBROWSER_COLOR_RED);
	setExpanded(bulletGroupItem,_bulletPropertiesExpanded);

	QtProperty *odeGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"ODE properties");
	odeGroup->theBrightness=140;
	odeGroupItem=addProperty(odeGroup);
	setBackgroundColor(odeGroupItem,QTPROPERTYBROWSER_COLOR_GREEN);
	setExpanded(odeGroupItem,_odePropertiesExpanded);

	QtProperty *vortexGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Vortex properties");
	vortexGroup->theBrightness=140;
	vortexGroupItem=addProperty(vortexGroup);
	setBackgroundColor(vortexGroupItem,QTPROPERTYBROWSER_COLOR_BLUE);
	setExpanded(vortexGroupItem,_vortexPropertiesExpanded);

	// Bullet:
	p_bulletTimeStep = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletTimeStep);
	p_bulletConstraintSolvIterat = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletConstraintSolvIterat);
	p_bulletInternalScaling = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletInternalScaling);
	p_bulletInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	bulletGroup->addSubProperty(p_bulletInternalFullScaling);
	p_bulletCollMarginScaling = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletCollMarginScaling);

	// ODE:
	p_odeTimeStep = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeTimeStep);
	p_odeQuickStep = variantManager->addProperty(QVariant::Bool,"");
	odeGroup->addSubProperty(p_odeQuickStep);
	p_odeIterations = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeIterations);
	p_odeInternalScaling = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeInternalScaling);
	p_odeInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	odeGroup->addSubProperty(p_odeInternalFullScaling);
	p_odeGlobalErp = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeGlobalErp);
	p_odeGlobalCfm = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeGlobalCfm);

	// Vortex:
	p_vortexTimeStep = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexTimeStep);
	p_vortexContactTolerance = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexContactTolerance);
	p_vortexInternalScaling = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexInternalScaling);
	p_vortexInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexInternalFullScaling);
	p_vortexAutoSleep = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexAutoSleep);
	p_vortexMultithreading = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexMultithreading);

	QtProperty* vortexConstraint = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Constraint properties");
	vortexGroup->addSubProperty(vortexConstraint);
	vortexConstraintItem=getSubPropertyBrowserItem(vortexGroupItem,vortexConstraint);
	setExpanded(vortexConstraintItem,_vortexConstraintPropertiesExpanded);

	p_vortexConstraintLinearCompliance = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearCompliance);
	p_vortexConstraintLinearDamping = variantManager->addProperty(QVariant::String,"");
//.........这里部分代码省略.........
开发者ID:dtbinh,项目名称:vrep_altair,代码行数:101,代码来源:propBrowser_engineProp_general.cpp


注:本文中的QtProperty::addSubProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。