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


C++ QtVariantProperty::setAttribute方法代码示例

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


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

示例1: postInitializeProperty

    void FontPropertyManager::postInitializeProperty(QtVariantPropertyManager *vm,
                                                     QtProperty *property,
                                                     int type,
                                                     int enumTypeId)
    {
        if (type != QVariant::Font)
            return;

        // This will cause a recursion
        QtVariantProperty *antialiasing = vm->addProperty(enumTypeId, QCoreApplication::translate("FontPropertyManager", "Antialiasing"));
        const QFont font = qVariantValue<QFont>(vm->variantProperty(property)->value());

        antialiasing->setAttribute(QLatin1String("enumNames"), m_aliasingEnumNames);
        antialiasing->setValue(antialiasingToIndex(font.styleStrategy()));
        property->addSubProperty(antialiasing);

        m_propertyToAntialiasing[property] = antialiasing;
        m_antialiasingToProperty[antialiasing] = property;
        // Fiddle family names
        if (!m_familyMappings.empty()) {
            const PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(m_createdFontProperty);
            QtVariantProperty *familyProperty = vm->variantProperty(it.value().front());
            const QString enumNamesAttribute = QLatin1String("enumNames");
            QStringList plainFamilyNames = familyProperty->attributeValue(enumNamesAttribute).toStringList();
            // Did someone load fonts or something?
            if (m_designerFamilyNames.size() != plainFamilyNames.size())
                m_designerFamilyNames = designerFamilyNames(plainFamilyNames, m_familyMappings);
            familyProperty->setAttribute(enumNamesAttribute, m_designerFamilyNames);
        }
        // Next
        m_createdFontProperty = 0;
    }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例2: addLayerProperties

void PropertyBrowser::addLayerProperties(QtProperty *parent)
{
    createProperty(NameProperty, QVariant::String, tr("Name"), parent);
    createProperty(VisibleProperty, QVariant::Bool, tr("Visible"), parent);

    QtVariantProperty *opacityProperty =
            createProperty(OpacityProperty, QVariant::Double, tr("Opacity"), parent);
    opacityProperty->setAttribute(QLatin1String("minimum"), 0.0);
    opacityProperty->setAttribute(QLatin1String("maximum"), 1.0);
    opacityProperty->setAttribute(QLatin1String("singleStep"), 0.1);
}
开发者ID:josephbleau,项目名称:tiled,代码行数:11,代码来源:propertybrowser.cpp

示例3: QString

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

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


    #ifdef QT_DEBUG
        item = manager->addProperty(QVariant::Int, QString(QObject::tr("id(发布版本无此项)")));
        item->setValue("0");
        item->setEnabled(false);
        parameters->addSubProperty(item);
        propertyTable.insert("/map_key/base/id", item);
    #endif

    item = manager->addProperty(QVariant::String, QString(QObject::tr("图名")));
    item->setValue(QObject::tr("交会图"));
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/base/title", item);

    item = manager->addProperty(QVariant::Double, QString(QObject::tr("宽度")));
    item->setValue(400);
    item->setAttribute(QLatin1String("minimum"), 0);
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/base/width", item);

    item = manager->addProperty(QVariant::Double, QString(QObject::tr("高度")));
    item->setValue(300);
    item->setAttribute(QLatin1String("minimum"), 0);
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/base/height", item);

    item = manager->addProperty(QVariant::Double, QString(QObject::tr("x")));
    item->setValue(0);
    item->setAttribute(QLatin1String("minimum"), 0);
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/base/x", item);

    item = manager->addProperty(QVariant::Double, QString(QObject::tr("y")));
    item->setValue(0);
    item->setAttribute(QLatin1String("minimum"), 0);
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/base/y", item);

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

示例4: main

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

	QtVariantPropertyManager *variantManager = new VariantManager();
	QtVariantProperty *priority = variantManager->addProperty(QVariant::Int, "Priority");

	priority->setToolTip("Task Priority");

	priority->setAttribute("minimum", 1);
	priority->setAttribute("maximum", 5);
	priority->setValue(3);

	QtVariantProperty *reportType = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(), "Report Type");
	QStringList types;
	types << "Bug" << "Suggestion" << "To Do";
	reportType->setAttribute("enumNames", types);
	reportType->setValue(1); // current value will be "Suggestion"

	QtVariantProperty *task1 = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(), "Task 1");

	task1->addSubProperty(priority);
	task1->addSubProperty(reportType);

	QtTreePropertyBrowser *browser = new QtTreePropertyBrowser();

	QtVariantEditorFactory *variantFactory = new VariantFactory();
	browser->setFactoryForManager(variantManager, variantFactory);

	browser->addProperty(task1);
	browser->show();

	QtVariantProperty *example = variantManager->addProperty(VariantManager::filePathTypeId(), "Example");
	example->setValue("main.cpp");
	example->setAttribute("filter", "Source files (*.cpp *.c)");

	
	QObject::connect(variantManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)),
					&t, SLOT(onValueChanged(QtProperty * , const QVariant &)));

	task1->addSubProperty(example);

	return app.exec();
}
开发者ID:nhatson1987,项目名称:QtPropBuildTest,代码行数:46,代码来源:main.cpp

示例5: initializeProperty

void BrushPropertyManager::initializeProperty(QtVariantPropertyManager *vm, QtProperty *property, int enumTypeId)
{
    m_brushValues.insert(property, QBrush());
    // style
    QtVariantProperty *styleSubProperty = vm->addProperty(enumTypeId, QCoreApplication::translate("BrushPropertyManager", "Style"));
    property->addSubProperty(styleSubProperty);
    QStringList styles;
    const int brushStyleCount = sizeof(brushStyles)/sizeof(const char *);
    for (int i = 0; i < brushStyleCount; i++)
        styles.push_back(QCoreApplication::translate("BrushPropertyManager", brushStyles[i]));
    styleSubProperty->setAttribute(QLatin1String("enumNames"), styles);
    styleSubProperty->setAttribute(QLatin1String("enumIcons"), qVariantFromValue(brushStyleIcons()));
    m_brushPropertyToStyleSubProperty.insert(property, styleSubProperty);
    m_brushStyleSubPropertyToProperty.insert(styleSubProperty, property);
    // color
    QtVariantProperty *colorSubProperty = vm->addProperty(QVariant::Color, QCoreApplication::translate("BrushPropertyManager", "Color"));
    property->addSubProperty(colorSubProperty);
    m_brushPropertyToColorSubProperty.insert(property, colorSubProperty);
    m_brushColorSubPropertyToProperty.insert(colorSubProperty, property);
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例6: addCurveSet

void QwtPlotPropertySetDialog::addCurveSet(QwtPlotCurve* curve)
{
    m_enableSet = false;
    int curveID = makeCurveBaseID(curve);
    QString name = QStringLiteral("%1-图表参数").arg(curve->title().text());
    QtProperty *groupItem = m_propertyGroup->addProperty(name);
    QtVariantProperty *pro = nullptr;

    m_property_id.rememberTheProperty(curveID,groupItem);
    pro = m_property_id.addVariantPropertyInGroup(m_variantManager,QVariant::String
                                                  ,groupItem,QStringLiteral("标题")
                                                  ,makeCurvePropertyID(curveID,ID_CurveTitle)
                                                  ,curve->title().text());

    const QPen pen = curve->pen();
    pro=  m_property_id.addVariantPropertyInGroup(m_variantManager,QVariant::Color
                                                  ,groupItem,QStringLiteral("颜色")
                                                  ,makeCurvePropertyID(curveID,ID_CurveColore)
                                                  ,pen.color());

    pro = m_property_id.addVariantPropertyInGroup(m_variantManager,QVariant::Int
                                                  ,groupItem,QStringLiteral("线宽")
                                                  ,makeCurvePropertyID(curveID,ID_CurveWidth)
                                                  ,pen.width());
    pro->setAttribute(QStringLiteral("singleStep"), 1);

    pro = m_property_id.addVariantPropertyInGroup(m_variantManager,QtVariantPropertyManager::enumTypeId()
                                                  ,groupItem,QStringLiteral("线形")
                                                  ,makeCurvePropertyID(curveID,ID_CurvePenStyle)
                                                  ,penStyle2Order(pen.style()));
    pro->setAttribute(QLatin1String("enumNames"),QStringList()
                      <<QStringLiteral("实线")
                      <<QStringLiteral("虚线")
                      <<QStringLiteral("点线")
                      <<QStringLiteral("点划线")
                      <<QStringLiteral("双点划线")
                      );
    m_property->addProperty(groupItem);
    m_enableSet = true;
}
开发者ID:czyt1988,项目名称:chart,代码行数:40,代码来源:QwtPlotPropertySetDialog.cpp

示例7: addImageLayerProperties

void PropertyBrowser::addImageLayerProperties()
{
    QtProperty *groupProperty = mGroupManager->addProperty(tr("Image Layer"));
    addLayerProperties(groupProperty);

    QtVariantProperty *imageSourceProperty = createProperty(ImageSourceProperty,
                                                            VariantPropertyManager::filePathTypeId(),
                                                            tr("Image"), groupProperty);

    imageSourceProperty->setAttribute(QLatin1String("filter"),
                                      Utils::readableImageFormatsFilter());

    createProperty(ColorProperty, QVariant::Color, tr("Transparent Color"), groupProperty);
    addProperty(groupProperty);
}
开发者ID:josephbleau,项目名称:tiled,代码行数:15,代码来源:propertybrowser.cpp

示例8: addMapObjectProperties

void PropertyBrowser::addMapObjectProperties()
{
    QtProperty *groupProperty = mGroupManager->addProperty(tr("Object"));
    createProperty(NameProperty, QVariant::String, tr("Name"), groupProperty);

    QtVariantProperty *typeProperty =
            createProperty(TypeProperty, QVariant::String, tr("Type"), groupProperty);
    typeProperty->setAttribute(QLatin1String("suggestions"), objectTypeNames());

    createProperty(VisibleProperty, QVariant::Bool, tr("Visible"), groupProperty);
    createProperty(PositionProperty, QVariant::PointF, tr("Position"), groupProperty);
    createProperty(SizeProperty, QVariant::SizeF, tr("Size"), groupProperty);
    createProperty(RotationProperty, QVariant::Double, tr("Rotation"), groupProperty);

    if (!static_cast<const MapObject*>(mObject)->cell().isEmpty()) {
        QtVariantProperty *flippingProperty =
                createProperty(FlippingProperty, VariantPropertyManager::flagTypeId(),
                               tr("Flipping"), groupProperty);

        flippingProperty->setAttribute(QLatin1String("flagNames"), mFlippingFlagNames);
    }

    addProperty(groupProperty);
}
开发者ID:josephbleau,项目名称:tiled,代码行数:24,代码来源:propertybrowser.cpp

示例9: addObjectGroupProperties

void PropertyBrowser::addObjectGroupProperties()
{
    QtProperty *groupProperty = mGroupManager->addProperty(tr("Object Layer"));
    addLayerProperties(groupProperty);

    createProperty(ColorProperty, QVariant::Color, tr("Color"), groupProperty);

    QtVariantProperty *drawOrderProperty =
            createProperty(DrawOrderProperty,
                           QtVariantPropertyManager::enumTypeId(),
                           tr("Drawing Order"),
                           groupProperty);

    drawOrderProperty->setAttribute(QLatin1String("enumNames"), mDrawOrderNames);

    addProperty(groupProperty);
}
开发者ID:josephbleau,项目名称:tiled,代码行数:17,代码来源:propertybrowser.cpp

示例10:

QtVariantProperty *ObjectTypesEditor::createProperty(int type,
                                                     const QString &name)
{
    QtVariantProperty *property = mVariantManager->addProperty(type, name);
    if (!property) {
        // fall back to string property for unsupported property types
        property = mVariantManager->addProperty(QVariant::String, name);
    }

    if (type == QVariant::Bool)
        property->setAttribute(QLatin1String("textVisible"), false);

    mUi->propertiesView->addProperty(property);
    mNameToProperty.insert(name, property);

    return property;
}
开发者ID:ihuangx,项目名称:tiled,代码行数:17,代码来源:objecttypeseditor.cpp

示例11:

QtVariantProperty *PropertyBrowser::createProperty(PropertyId id, int type,
                                                   const QString &name,
                                                   QtProperty *parent)
{
    QtVariantProperty *property = mVariantManager->addProperty(type, name);
    if (type == QVariant::Bool)
        property->setAttribute(QLatin1String("textVisible"), false);

    parent->addSubProperty(property);
    mPropertyToId.insert(property, id);

    if (id != CustomProperty)
        mIdToProperty.insert(id, property);
    else
        mNameToProperty.insert(name, property);

    return property;
}
开发者ID:josephbleau,项目名称:tiled,代码行数:18,代码来源:propertybrowser.cpp

示例12: addPlotSet

void QwtPlotPropertySetDialog::addPlotSet(ChartWave_qwt* plot)
{
    m_enableSet = false;
    //图表参数
    QtVariantProperty *pro = nullptr;
    QtProperty *groupItem = m_propertyGroup->addProperty(QStringLiteral("图表参数"));
    m_property_id.rememberTheProperty(ID_GroupPlot,groupItem);
    m_property_id.addVariantPropertyInGroup(m_variantManager,QVariant::String
                                            ,groupItem,QStringLiteral("图表标题"),ID_PlotTitle,m_plot->title().text());
    m_property_id.addVariantPropertyInGroup(m_variantManager,QVariant::String
                                            ,groupItem,QStringLiteral("脚标"),ID_PlotFooter,m_plot->footer().text());
    m_property_id.addVariantPropertyInGroup(m_variantManager,QVariant::Color
                                            ,groupItem,QStringLiteral("画布背景"),ID_PlotCanvasBackground,m_plot->canvasBackground().color());
    m_property_id.addVariantPropertyInGroup(m_variantManager,QVariant::Bool
                                            ,groupItem,QStringLiteral("缩放滚动条"),ID_PlotEnableZoomerScroll,m_plot->isEnableZoomerScroll());

    //坐标轴设置

    pro = m_property_id.addVariantPropertyInGroup(m_variantManager,QtVariantPropertyManager::flagTypeId()
                                                  ,groupItem,QStringLiteral("坐标轴设置"),ID_PlotAxisSet,getAxisEnable(plot));
    pro->setAttribute(QLatin1String("flagNames"), QStringList()
                      <<QStringLiteral("x底")
                      <<QStringLiteral("x顶")
                      <<QStringLiteral("y左")
                      <<QStringLiteral("y右")
                      );//在setAttribute过程中会触发onPropertyValueChanged,而onPropertyValueChanged的值是0,需要使用m_enableAxisEnableSet来抑制
    pro->setValue(getAxisEnable(plot));

    //轴详细设置
    addAxisSet(groupItem,plot,QwtPlot::xBottom);
    addAxisSet(groupItem,plot,QwtPlot::yLeft);
    addAxisSet(groupItem,plot,QwtPlot::xTop);
    addAxisSet(groupItem,plot,QwtPlot::yRight);
    m_property->addProperty(groupItem);
    m_enableSet = true;
}
开发者ID:czyt1988,项目名称:chart,代码行数:36,代码来源:QwtPlotPropertySetDialog.cpp

示例13: setupProperties

void AbstractItemEditor::setupProperties(PropertyDefinition *propList)
{
    for (int i = 0; propList[i].name; i++) {
        int type = propList[i].typeFunc ? propList[i].typeFunc() : propList[i].type;
        int role = propList[i].role;
        QtVariantProperty *prop = m_propertyManager->addProperty(type, QLatin1String(propList[i].name));
        Q_ASSERT(prop);
        if (role == Qt::ToolTipPropertyRole || role == Qt::WhatsThisPropertyRole)
            prop->setAttribute(QLatin1String("validationMode"), ValidationRichText);
        else if (role == Qt::DisplayPropertyRole)
            prop->setAttribute(QLatin1String("validationMode"), ValidationMultiLine);
        else if (role == Qt::StatusTipPropertyRole)
            prop->setAttribute(QLatin1String("validationMode"), ValidationSingleLine);
        else if (role == ItemFlagsShadowRole)
            prop->setAttribute(QLatin1String("flagNames"), c2qStringList(itemFlagNames));
        else if (role == Qt::CheckStateRole)
            prop->setAttribute(QLatin1String("enumNames"), c2qStringList(checkStateNames));
        prop->setAttribute(QLatin1String("resettable"), true);
        m_properties.append(prop);
        m_rootProperties.append(prop);
        m_propertyToRole.insert(prop, role);
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:23,代码来源:itemlisteditor.cpp

示例14: itemClicked

void MainWindow::itemClicked(QtCanvasItem *item)
{
    updateExpandState();

    QMap<QtProperty *, QString>::ConstIterator itProp = propertyToId.constBegin();
    while (itProp != propertyToId.constEnd()) {
        delete itProp.key();
        itProp++;
    }
    propertyToId.clear();
    idToProperty.clear();

    currentItem = item;
    if (!currentItem) {
        deleteAction->setEnabled(false);
        return;
    }

    deleteAction->setEnabled(true);

    QtVariantProperty *property;

    property = variantManager->addProperty(QVariant::Double, tr("Position X"));
    property->setAttribute(QLatin1String("minimum"), 0);
    property->setAttribute(QLatin1String("maximum"), canvas->width());
    property->setValue(item->x());
    addProperty(property, QLatin1String("xpos"));

    property = variantManager->addProperty(QVariant::Double, tr("Position Y"));
    property->setAttribute(QLatin1String("minimum"), 0);
    property->setAttribute(QLatin1String("maximum"), canvas->height());
    property->setValue(item->y());
    addProperty(property, QLatin1String("ypos"));

    property = variantManager->addProperty(QVariant::Double, tr("Position Z"));
    property->setAttribute(QLatin1String("minimum"), 0);
    property->setAttribute(QLatin1String("maximum"), 256);
    property->setValue(item->z());
    addProperty(property, QLatin1String("zpos"));

    if (item->rtti() == QtCanvasItem::Rtti_Rectangle) {
        QtCanvasRectangle *i = (QtCanvasRectangle *)item;

        property = variantManager->addProperty(QVariant::Color, tr("Brush Color"));
        property->setValue(i->brush().color());
        addProperty(property, QLatin1String("brush"));

        property = variantManager->addProperty(QVariant::Color, tr("Pen Color"));
        property->setValue(i->pen().color());
        addProperty(property, QLatin1String("pen"));

        property = variantManager->addProperty(QVariant::Size, tr("Size"));
        property->setValue(i->size());
        addProperty(property, QLatin1String("size"));
    } else if (item->rtti() == QtCanvasItem::Rtti_Line) {
        QtCanvasLine *i = (QtCanvasLine *)item;

        property = variantManager->addProperty(QVariant::Color, tr("Pen Color"));
        property->setValue(i->pen().color());
        addProperty(property, QLatin1String("pen"));

        property = variantManager->addProperty(QVariant::Point, tr("Vector"));
        property->setValue(i->endPoint());
        addProperty(property, QLatin1String("endpoint"));
    } else if (item->rtti() == QtCanvasItem::Rtti_Ellipse) {
        QtCanvasEllipse *i = (QtCanvasEllipse *)item;

        property = variantManager->addProperty(QVariant::Color, tr("Brush Color"));
        property->setValue(i->brush().color());
        addProperty(property, QLatin1String("brush"));

        property = variantManager->addProperty(QVariant::Size, tr("Size"));
        property->setValue(QSize(i->width(), i->height()));
        addProperty(property, QLatin1String("size"));
    } else if (item->rtti() == QtCanvasItem::Rtti_Text) {
        QtCanvasText *i = (QtCanvasText *)item;

        property = variantManager->addProperty(QVariant::Color, tr("Color"));
        property->setValue(i->color());
        addProperty(property, QLatin1String("color"));

        property = variantManager->addProperty(QVariant::String, tr("Text"));
        property->setValue(i->text());
        addProperty(property, QLatin1String("text"));

        property = variantManager->addProperty(QVariant::Font, tr("Font"));
        property->setValue(i->font());
        addProperty(property, QLatin1String("font"));
    }
}
开发者ID:darkfall,项目名称:exlibs,代码行数:90,代码来源:mainwindow.cpp

示例15: setObject

void PropertyEditor::setObject(QObject *object)
{
    QDesignerFormWindowInterface *oldFormWindow = QDesignerFormWindowInterface::findFormWindow(m_object);
    // In the first setObject() call following the addition of a dynamic property, focus and edit it.
    const bool editNewDynamicProperty = object != 0 && m_object == object && !m_recentlyAddedDynamicProperty.isEmpty();
    m_object = object;
    m_propertyManager->setObject(object);
    QDesignerFormWindowInterface *formWindow = QDesignerFormWindowInterface::findFormWindow(m_object);
    FormWindowBase *fwb = qobject_cast<FormWindowBase *>(formWindow);
    m_treeFactory->setFormWindowBase(fwb);
    m_groupFactory->setFormWindowBase(fwb);

    storeExpansionState();

    UpdateBlocker ub(this);

    updateToolBarLabel();

    QMap<QString, QtVariantProperty *> toRemove = m_nameToProperty;

    const QDesignerDynamicPropertySheetExtension *dynamicSheet =
            qt_extension<QDesignerDynamicPropertySheetExtension*>(m_core->extensionManager(), m_object);
    const QDesignerPropertySheet *sheet = qobject_cast<QDesignerPropertySheet*>(m_core->extensionManager()->extension(m_object, Q_TYPEID(QDesignerPropertySheetExtension)));

    // Optimizization: Instead of rebuilding the complete list every time, compile a list of properties to remove,
    // remove them, traverse the sheet, in case property exists just set a value, otherwise - create it.
    QExtensionManager *m = m_core->extensionManager();

    m_propertySheet = qobject_cast<QDesignerPropertySheetExtension*>(m->extension(object, Q_TYPEID(QDesignerPropertySheetExtension)));
    if (m_propertySheet) {
        const int propertyCount = m_propertySheet->count();
        for (int i = 0; i < propertyCount; ++i) {
            if (!m_propertySheet->isVisible(i))
                continue;

            const QString propertyName = m_propertySheet->propertyName(i);
            if (m_propertySheet->indexOf(propertyName) != i)
                continue;
            const QString groupName = m_propertySheet->propertyGroup(i);
            const QMap<QString, QtVariantProperty *>::const_iterator rit = toRemove.constFind(propertyName);
            if (rit != toRemove.constEnd()) {
                QtVariantProperty *property = rit.value();
                if (m_propertyToGroup.value(property) == groupName && toBrowserType(m_propertySheet->property(i), propertyName) == property->propertyType())
                    toRemove.remove(propertyName);
            }
        }
    }

    QMapIterator<QString, QtVariantProperty *> itRemove(toRemove);
    while (itRemove.hasNext()) {
        itRemove.next();

        QtVariantProperty *property = itRemove.value();
        m_nameToProperty.remove(itRemove.key());
        m_propertyToGroup.remove(property);
        delete property;
    }

    if (oldFormWindow != formWindow)
        reloadResourceProperties();

    bool isMainContainer = false;
    if (QWidget *widget = qobject_cast<QWidget*>(object)) {
        if (QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(widget)) {
            isMainContainer = (fw->mainContainer() == widget);
        }
    }
    m_groups.clear();

    if (m_propertySheet) {
        QtProperty *lastProperty = 0;
        QtProperty *lastGroup = 0;
        const int propertyCount = m_propertySheet->count();
        for (int i = 0; i < propertyCount; ++i) {
            if (!m_propertySheet->isVisible(i))
                continue;

            const QString propertyName = m_propertySheet->propertyName(i);
            if (m_propertySheet->indexOf(propertyName) != i)
                continue;
            const QVariant value = m_propertySheet->property(i);

            const int type = toBrowserType(value, propertyName);

            QtVariantProperty *property = m_nameToProperty.value(propertyName, 0);
            bool newProperty = property == 0;
            if (newProperty) {
                property = m_propertyManager->addProperty(type, propertyName);
                if (property) {
                    newProperty = true;
                    if (type == DesignerPropertyManager::enumTypeId()) {
                        const PropertySheetEnumValue e = qvariant_cast<PropertySheetEnumValue>(value);
                        QStringList names;
                        QStringListIterator it(e.metaEnum.keys());
                        while (it.hasNext())
                            names.append(it.next());
                        m_updatingBrowser = true;
                        property->setAttribute(m_strings.m_enumNamesAttribute, names);
                        m_updatingBrowser = false;
                    } else if (type == DesignerPropertyManager::designerFlagTypeId()) {
//.........这里部分代码省略.........
开发者ID:Fale,项目名称:qtmoko,代码行数:101,代码来源:propertyeditor.cpp


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