forked from qt-creator/qt-creator
QmlDesigner: ConnectionEditor hide readonly
Hide readonly properties in the ConnectionEditors target item property ComboBox. Task-number: QDS-5718 Change-Id: Idee217714d460a0a59954faf3c51641648e0657b Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
committed by
Henning Gründl
parent
e71e6b9583
commit
efa8e9fd9a
@@ -202,26 +202,26 @@ void ActionEditor::prepareConnections()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const QString name = QString::fromUtf8(propertyName);
|
const QString name = QString::fromUtf8(propertyName);
|
||||||
|
const bool writeable = modelNode.metaInfo().propertyIsWritable(propertyName);
|
||||||
TypeName type = modelNode.metaInfo().propertyTypeName(propertyName);
|
TypeName type = modelNode.metaInfo().propertyTypeName(propertyName);
|
||||||
if (type.contains("<cpp>."))
|
if (type.contains("<cpp>."))
|
||||||
type.remove(0, 6);
|
type.remove(0, 6);
|
||||||
|
|
||||||
connection.properties.append(ActionEditorDialog::PropertyOption(name, type));
|
connection.properties.append(ActionEditorDialog::PropertyOption(name, type, writeable));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const VariantProperty &variantProperty : modelNode.variantProperties()) {
|
for (const VariantProperty &variantProperty : modelNode.variantProperties()) {
|
||||||
if (variantProperty.isValid()) {
|
if (variantProperty.isValid() && variantProperty.isDynamic()) {
|
||||||
if (variantProperty.isDynamic()) {
|
if (!typeWhiteList.contains(variantProperty.dynamicTypeName()))
|
||||||
if (!typeWhiteList.contains(variantProperty.dynamicTypeName()))
|
continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
const QString name = QString::fromUtf8(variantProperty.name());
|
const QString name = QString::fromUtf8(variantProperty.name());
|
||||||
TypeName type = variantProperty.dynamicTypeName();
|
const bool writeable = modelNode.metaInfo().propertyIsWritable(variantProperty.name());
|
||||||
if (type.contains("<cpp>."))
|
TypeName type = variantProperty.dynamicTypeName();
|
||||||
type.remove(0, 6);
|
if (type.contains("<cpp>."))
|
||||||
|
type.remove(0, 6);
|
||||||
|
|
||||||
connection.properties.append(ActionEditorDialog::PropertyOption(name, type));
|
connection.properties.append(ActionEditorDialog::PropertyOption(name, type, writeable));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,10 +266,11 @@ void ActionEditor::prepareConnections()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const QString name = QString::fromUtf8(propertyName);
|
const QString name = QString::fromUtf8(propertyName);
|
||||||
|
const bool writeable = metaInfo.propertyIsWritable(propertyName);
|
||||||
if (type.contains("<cpp>."))
|
if (type.contains("<cpp>."))
|
||||||
type.remove(0, 6);
|
type.remove(0, 6);
|
||||||
|
|
||||||
singelton.properties.append(ActionEditorDialog::PropertyOption(name, type));
|
singelton.properties.append(ActionEditorDialog::PropertyOption(name, type, writeable));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!singelton.properties.isEmpty()) {
|
if (!singelton.properties.isEmpty()) {
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ void ActionEditorDialog::fillAndSetTargetItem(const QString &value, bool useDefa
|
|||||||
} else { // ConnectionType::Assignment
|
} else { // ConnectionType::Assignment
|
||||||
m_assignmentTargetItem->clear();
|
m_assignmentTargetItem->clear();
|
||||||
for (const auto &connection : qAsConst(m_connections)) {
|
for (const auto &connection : qAsConst(m_connections)) {
|
||||||
if (!connection.properties.isEmpty())
|
if (!connection.properties.isEmpty() && connection.hasWriteableProperties())
|
||||||
m_assignmentTargetItem->addItem(connection.item);
|
m_assignmentTargetItem->addItem(connection.item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,8 +516,10 @@ void ActionEditorDialog::fillAndSetTargetProperty(const QString &value, bool use
|
|||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
insertAndSetUndefined(m_assignmentTargetProperty);
|
insertAndSetUndefined(m_assignmentTargetProperty);
|
||||||
} else {
|
} else {
|
||||||
for (const auto &property : qAsConst(m_connections[idx].properties))
|
for (const auto &property : qAsConst(m_connections[idx].properties)) {
|
||||||
m_assignmentTargetProperty->addItem(property.name, property.type);
|
if (property.isWriteable)
|
||||||
|
m_assignmentTargetProperty->addItem(property.name, property.type);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_assignmentTargetProperty->findText(value) != -1) {
|
if (m_assignmentTargetProperty->findText(value) != -1) {
|
||||||
m_assignmentTargetProperty->setCurrentText(value);
|
m_assignmentTargetProperty->setCurrentText(value);
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ public:
|
|||||||
class PropertyOption
|
class PropertyOption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertyOption() {}
|
PropertyOption(const QString &n, const TypeName &t, bool writeable = true)
|
||||||
PropertyOption(const QString &n, const TypeName &t)
|
|
||||||
: name(n)
|
: name(n)
|
||||||
, type(t)
|
, type(t)
|
||||||
|
, isWriteable(writeable)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool operator==(const QString &value) const { return value == name; }
|
bool operator==(const QString &value) const { return value == name; }
|
||||||
@@ -62,6 +62,7 @@ public:
|
|||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
TypeName type;
|
TypeName type;
|
||||||
|
bool isWriteable;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SingletonOption
|
class SingletonOption
|
||||||
@@ -80,6 +81,16 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWriteableProperties() const
|
||||||
|
{
|
||||||
|
for (const auto &p : properties) {
|
||||||
|
if (p.isWriteable)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const QString &value) const { return value == item; }
|
bool operator==(const QString &value) const { return value == item; }
|
||||||
bool operator==(const SingletonOption &value) const { return value.item == item; }
|
bool operator==(const SingletonOption &value) const { return value.item == item; }
|
||||||
|
|
||||||
@@ -90,7 +101,6 @@ public:
|
|||||||
class ConnectionOption : public SingletonOption
|
class ConnectionOption : public SingletonOption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConnectionOption() {}
|
|
||||||
ConnectionOption(const QString &value) : SingletonOption(value) {}
|
ConnectionOption(const QString &value) : SingletonOption(value) {}
|
||||||
|
|
||||||
QStringList methods;
|
QStringList methods;
|
||||||
|
|||||||
Reference in New Issue
Block a user