forked from qt-creator/qt-creator
QmlDesigner: Add unusedProperty() as public member
Change-Id: If24e0d09145f0bb9e5459cae1b13302610818913 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -62,22 +62,6 @@ QString idOrTypeNameForNode(const QmlDesigner::ModelNode &modelNode)
|
|||||||
return idLabel;
|
return idLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlDesigner::PropertyName unusedProperty(const QmlDesigner::ModelNode &modelNode)
|
|
||||||
{
|
|
||||||
QmlDesigner::PropertyName propertyName = "property";
|
|
||||||
int i = 0;
|
|
||||||
if (modelNode.metaInfo().isValid()) {
|
|
||||||
while (true) {
|
|
||||||
const QmlDesigner::PropertyName currentPropertyName = propertyName + QString::number(i).toLatin1();
|
|
||||||
if (!modelNode.hasProperty(currentPropertyName) && !modelNode.metaInfo().hasProperty(currentPropertyName))
|
|
||||||
return currentPropertyName;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return propertyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant convertVariantForTypeName(const QVariant &variant, const QmlDesigner::TypeName &typeName)
|
QVariant convertVariantForTypeName(const QVariant &variant, const QmlDesigner::TypeName &typeName)
|
||||||
{
|
{
|
||||||
QVariant returnValue = variant;
|
QVariant returnValue = variant;
|
||||||
@@ -119,6 +103,22 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
QmlDesigner::PropertyName DynamicPropertiesModel::unusedProperty(const QmlDesigner::ModelNode &modelNode)
|
||||||
|
{
|
||||||
|
QmlDesigner::PropertyName propertyName = "property";
|
||||||
|
int i = 0;
|
||||||
|
if (modelNode.metaInfo().isValid()) {
|
||||||
|
while (true) {
|
||||||
|
const QmlDesigner::PropertyName currentPropertyName = propertyName + QString::number(i).toLatin1();
|
||||||
|
if (!modelNode.hasProperty(currentPropertyName) && !modelNode.metaInfo().hasProperty(currentPropertyName))
|
||||||
|
return currentPropertyName;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return propertyName;
|
||||||
|
}
|
||||||
|
|
||||||
DynamicPropertiesModel::DynamicPropertiesModel(ConnectionView *parent)
|
DynamicPropertiesModel::DynamicPropertiesModel(ConnectionView *parent)
|
||||||
: QStandardItemModel(parent)
|
: QStandardItemModel(parent)
|
||||||
, m_connectionView(parent)
|
, m_connectionView(parent)
|
||||||
|
@@ -69,6 +69,8 @@ public:
|
|||||||
BindingProperty replaceVariantWithBinding(const PropertyName &name, bool copyValue = false);
|
BindingProperty replaceVariantWithBinding(const PropertyName &name, bool copyValue = false);
|
||||||
void resetProperty(const PropertyName &name);
|
void resetProperty(const PropertyName &name);
|
||||||
|
|
||||||
|
QmlDesigner::PropertyName unusedProperty(const QmlDesigner::ModelNode &modelNode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void addProperty(const QVariant &propertyValue,
|
void addProperty(const QVariant &propertyValue,
|
||||||
const QString &propertyType,
|
const QString &propertyType,
|
||||||
|
Reference in New Issue
Block a user