forked from qt-creator/qt-creator
QmlDesigner: single-char QString operations for efficiency
This commit is contained in:
@@ -316,7 +316,7 @@ PropertyEditor::~PropertyEditor()
|
|||||||
static inline QString fixTypeNameForPanes(const QString &typeName)
|
static inline QString fixTypeNameForPanes(const QString &typeName)
|
||||||
{
|
{
|
||||||
QString fixedTypeName = typeName;
|
QString fixedTypeName = typeName;
|
||||||
fixedTypeName.replace(".", "/");
|
fixedTypeName.replace('.', '/');
|
||||||
fixedTypeName.replace("QtQuick/", "Qt/");
|
fixedTypeName.replace("QtQuick/", "Qt/");
|
||||||
return fixedTypeName;
|
return fixedTypeName;
|
||||||
}
|
}
|
||||||
@@ -891,7 +891,7 @@ void PropertyEditor::reloadQml()
|
|||||||
QString PropertyEditor::qmlFileName(const NodeMetaInfo &nodeInfo) const
|
QString PropertyEditor::qmlFileName(const NodeMetaInfo &nodeInfo) const
|
||||||
{
|
{
|
||||||
if (nodeInfo.typeName().split('.').last() == "QDeclarativeItem")
|
if (nodeInfo.typeName().split('.').last() == "QDeclarativeItem")
|
||||||
return "Qt/ItemPane.qml";
|
return "Qt/ItemPane.qml";
|
||||||
const QString fixedTypeName = fixTypeNameForPanes(nodeInfo.typeName());
|
const QString fixedTypeName = fixTypeNameForPanes(nodeInfo.typeName());
|
||||||
return fixedTypeName + QLatin1String("Pane.qml");
|
return fixedTypeName + QLatin1String("Pane.qml");
|
||||||
}
|
}
|
||||||
|
@@ -486,8 +486,8 @@ void QmlAnchorBindingProxy::removeTopAnchor() {
|
|||||||
m_fxItemNode.anchors().removeAnchor(AnchorLine::Top);
|
m_fxItemNode.anchors().removeAnchor(AnchorLine::Top);
|
||||||
m_fxItemNode.anchors().removeMargin(AnchorLine::Top);
|
m_fxItemNode.anchors().removeMargin(AnchorLine::Top);
|
||||||
|
|
||||||
if (qFuzzyCompare(m_fxItemNode.instancePosition().y(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "y"))
|
if (qFuzzyCompare(m_fxItemNode.instancePosition().y(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + 'y'))
|
||||||
m_fxItemNode.setVariantProperty("y", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "y"));
|
m_fxItemNode.setVariantProperty('y', m_fxItemNode.modelNode().auxiliaryData(auxDataString + 'y'));
|
||||||
if (qFuzzyCompare(m_fxItemNode.instanceSize().height(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "height"))
|
if (qFuzzyCompare(m_fxItemNode.instanceSize().height(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "height"))
|
||||||
m_fxItemNode.setVariantProperty("height", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "height"));
|
m_fxItemNode.setVariantProperty("height", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "height"));
|
||||||
|
|
||||||
@@ -509,8 +509,8 @@ void QmlAnchorBindingProxy::removeLeftAnchor() {
|
|||||||
m_fxItemNode.anchors().removeAnchor(AnchorLine::Left);
|
m_fxItemNode.anchors().removeAnchor(AnchorLine::Left);
|
||||||
m_fxItemNode.anchors().removeMargin(AnchorLine::Left);
|
m_fxItemNode.anchors().removeMargin(AnchorLine::Left);
|
||||||
|
|
||||||
if (qFuzzyCompare(m_fxItemNode.instancePosition().x(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "x"))
|
if (qFuzzyCompare(m_fxItemNode.instancePosition().x(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + 'x'))
|
||||||
m_fxItemNode.setVariantProperty("x", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "x"));
|
m_fxItemNode.setVariantProperty('x', m_fxItemNode.modelNode().auxiliaryData(auxDataString + 'x'));
|
||||||
if (qFuzzyCompare(m_fxItemNode.instanceSize().width(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "width"))
|
if (qFuzzyCompare(m_fxItemNode.instanceSize().width(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "width"))
|
||||||
m_fxItemNode.setVariantProperty("width", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "width"));
|
m_fxItemNode.setVariantProperty("width", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "width"));
|
||||||
}
|
}
|
||||||
@@ -588,10 +588,10 @@ void QmlAnchorBindingProxy::fill()
|
|||||||
|
|
||||||
RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
|
RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
|
||||||
|
|
||||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "x", m_fxItemNode.instancePosition().x());
|
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + 'x', m_fxItemNode.instancePosition().x());
|
||||||
m_fxItemNode.removeVariantProperty("x");
|
m_fxItemNode.removeVariantProperty('x');
|
||||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "y", m_fxItemNode.instancePosition().y());
|
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + 'y', m_fxItemNode.instancePosition().y());
|
||||||
m_fxItemNode.removeVariantProperty("y");
|
m_fxItemNode.removeVariantProperty('y');
|
||||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "width", m_fxItemNode.instanceSize().width());
|
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "width", m_fxItemNode.instanceSize().width());
|
||||||
m_fxItemNode.removeVariantProperty("width");
|
m_fxItemNode.removeVariantProperty("width");
|
||||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "height", m_fxItemNode.instanceSize().height());
|
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "height", m_fxItemNode.instanceSize().height());
|
||||||
|
@@ -100,7 +100,7 @@ void SiblingComboBox::setup()
|
|||||||
parentString += parent.simplifiedTypeName();
|
parentString += parent.simplifiedTypeName();
|
||||||
else
|
else
|
||||||
parentString += parent.id();
|
parentString += parent.id();
|
||||||
parentString += ")";
|
parentString += ')';
|
||||||
insertItem(0, parentString);
|
insertItem(0, parentString);
|
||||||
}
|
}
|
||||||
setCurrentIndex(m_itemList.indexOf(m_selectedItemNode));
|
setCurrentIndex(m_itemList.indexOf(m_selectedItemNode));
|
||||||
|
@@ -104,8 +104,8 @@ public:
|
|||||||
type = ref->ast()->memberType->asString();
|
type = ref->ast()->memberType->asString();
|
||||||
m_properties.append(qMakePair(name, type));
|
m_properties.append(qMakePair(name, type));
|
||||||
} else {
|
} else {
|
||||||
if (const Interpreter::QmlObjectValue * ov = dynamic_cast<const Interpreter::QmlObjectValue *>(value)) {
|
if (const Interpreter::QmlObjectValue * ov = dynamic_cast<const Interpreter::QmlObjectValue *>(value)) {
|
||||||
QString qualifiedTypeName = ov->packageName().isEmpty() ? ov->className() : ov->packageName() + "." + ov->className();
|
QString qualifiedTypeName = ov->packageName().isEmpty() ? ov->className() : ov->packageName() + '.' + ov->className();
|
||||||
m_properties.append(qMakePair(name, qualifiedTypeName));
|
m_properties.append(qMakePair(name, qualifiedTypeName));
|
||||||
} else {
|
} else {
|
||||||
Interpreter::TypeId typeId;
|
Interpreter::TypeId typeId;
|
||||||
@@ -158,9 +158,9 @@ QStringList prototypes(const Interpreter::ObjectValue *ov, LookupContext::Ptr co
|
|||||||
const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov);
|
const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov);
|
||||||
if (qmlValue) {
|
if (qmlValue) {
|
||||||
if (versions) {
|
if (versions) {
|
||||||
list << qmlValue->packageName() + "." + qmlValue->className() +
|
list << qmlValue->packageName() + '.' + qmlValue->className() +
|
||||||
" " + QString::number(qmlValue->version().majorVersion()) +
|
' ' + QString::number(qmlValue->version().majorVersion()) +
|
||||||
"." + QString::number(qmlValue->version().minorVersion());
|
'.' + QString::number(qmlValue->version().minorVersion());
|
||||||
} else {
|
} else {
|
||||||
list << qmlValue->packageName() + "." + qmlValue->className();
|
list << qmlValue->packageName() + "." + qmlValue->className();
|
||||||
}
|
}
|
||||||
@@ -662,7 +662,7 @@ bool NodeMetaInfoPrivate::cleverCheckType(const QString &otherType) const
|
|||||||
typeName = split.at(1);
|
typeName = split.at(1);
|
||||||
}
|
}
|
||||||
if (packageName() == package)
|
if (packageName() == package)
|
||||||
return QString(package + "." + typeName) == qualfiedTypeName();
|
return QString(package + '.' + typeName) == qualfiedTypeName();
|
||||||
|
|
||||||
const LanguageUtils::FakeMetaObject::Export exp =
|
const LanguageUtils::FakeMetaObject::Export exp =
|
||||||
getQmlObjectValue()->metaObject()->exportInPackage(package);
|
getQmlObjectValue()->metaObject()->exportInPackage(package);
|
||||||
@@ -770,7 +770,7 @@ QString NodeMetaInfoPrivate::lookupName() const
|
|||||||
QStringList NodeMetaInfoPrivate::lookupNameComponent() const
|
QStringList NodeMetaInfoPrivate::lookupNameComponent() const
|
||||||
{
|
{
|
||||||
QString tempString = m_qualfiedTypeName;
|
QString tempString = m_qualfiedTypeName;
|
||||||
return tempString.split(".");
|
return tempString.split('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NodeMetaInfoPrivate::isValid() const
|
bool NodeMetaInfoPrivate::isValid() const
|
||||||
@@ -801,7 +801,7 @@ void NodeMetaInfoPrivate::setupPrototypes()
|
|||||||
description.minorVersion = qmlValue->version().minorVersion();
|
description.minorVersion = qmlValue->version().minorVersion();
|
||||||
description.majorVersion = qmlValue->version().majorVersion();
|
description.majorVersion = qmlValue->version().majorVersion();
|
||||||
if (!qmlValue->packageName().isEmpty())
|
if (!qmlValue->packageName().isEmpty())
|
||||||
description.className = qmlValue->packageName() + "." + description.className;
|
description.className = qmlValue->packageName() + '.' + description.className;
|
||||||
m_prototypes.append(description);
|
m_prototypes.append(description);
|
||||||
} else {
|
} else {
|
||||||
if (lookupContext()->context()->lookupType(document(), QStringList() << ov->className()))
|
if (lookupContext()->context()->lookupType(document(), QStringList() << ov->className()))
|
||||||
|
@@ -138,7 +138,7 @@ QString QmlTextGenerator::toQml(const ModelNode &node, int indentDepth) const
|
|||||||
QString type = node.type();
|
QString type = node.type();
|
||||||
QString url;
|
QString url;
|
||||||
if (type.contains('.')) {
|
if (type.contains('.')) {
|
||||||
QStringList nameComponents = type.split(".");
|
QStringList nameComponents = type.split('.');
|
||||||
url = nameComponents.first();
|
url = nameComponents.first();
|
||||||
type = nameComponents.last();
|
type = nameComponents.last();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user