Commit 61411f94 authored by Tim Jenssen's avatar Tim Jenssen Committed by Tim Jenssen

Keep QT_RESTRICTED_CAST_FROM_ASCII in the designer

There is no reason to undefine QT_RESTRICTED_CAST_FROM_ASCII (anymore).

Change-Id: Iabeacc8a89d662e78986e2dc275c2096a9c9e519
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@theqtcompany.com>
parent d27d5105
......@@ -50,7 +50,7 @@ static inline QString componentIdForModelNode(const ModelNode &modelNode)
if (modelNode.hasParentProperty()
&& modelNode.parentProperty().name() != "data"
&& modelNode.parentProperty().name() != "children") {
return modelNode.parentProperty().name();
return QString::fromUtf8(modelNode.parentProperty().name());
} else {
return modelNode.simplifiedTypeName();
}
......
......@@ -42,7 +42,7 @@ ModelNodeContextMenu::ModelNodeContextMenu(AbstractView *view) :
}
static QSet<ActionInterface* > findMembers(QSet<ActionInterface* > actionInterface,
const QString &category)
const QByteArray &category)
{
QSet<ActionInterface* > ret;
......@@ -55,7 +55,7 @@ static QSet<ActionInterface* > findMembers(QSet<ActionInterface* > actionInterfa
void populateMenu(QSet<ActionInterface* > &actionInterfaces,
const QString &category,
const QByteArray &category,
QMenu* menu,
const SelectionContext &selectionContext)
{
......@@ -96,7 +96,7 @@ void ModelNodeContextMenu::execute(const QPoint &position, bool selectionMenuBoo
QSet<ActionInterface* > factories =
QSet<ActionInterface* >::fromList(QmlDesignerPlugin::instance()->designerActionManager().designerActions());
populateMenu(factories, QString(""), mainMenu, m_selectionContext);
populateMenu(factories, QByteArray(), mainMenu, m_selectionContext);
mainMenu->exec(position);
mainMenu->deleteLater();
......
......@@ -627,11 +627,11 @@ static QStringList getSortedSignalNameList(const ModelNode &modelNode)
if (metaInfo.isValid()) {
foreach (const PropertyName &signalName, sortedPropertyNameList(metaInfo.signalNames()))
if (!signalName.contains("Changed"))
signalNames.append(signalName);
signalNames.append(QString::fromUtf8(signalName));
foreach (const PropertyName &propertyName, sortedPropertyNameList(metaInfo.propertyNames()))
if (!propertyName.contains("."))
signalNames.append(propertyName + "Changed");
signalNames.append(QString::fromUtf8(propertyName + "Changed"));
}
return signalNames;
......
......@@ -173,7 +173,7 @@ void FormEditorScene::synchronizeParent(const QmlItemNode &qmlItemNode)
reparentItem(qmlItemNode, parentNode);
}
void FormEditorScene::synchronizeOtherProperty(const QmlItemNode &qmlItemNode, const QString &propertyName)
void FormEditorScene::synchronizeOtherProperty(const QmlItemNode &qmlItemNode, const QByteArray &propertyName)
{
if (hasItemForQmlItemNode(qmlItemNode)) {
FormEditorItem *item = itemForQmlItemNode(qmlItemNode);
......
......@@ -71,7 +71,7 @@ public:
void synchronizeTransformation(const QmlItemNode &qmlItemNode);
void synchronizeParent(const QmlItemNode &qmlItemNode);
void synchronizeOtherProperty(const QmlItemNode &qmlItemNode, const QString &propertyName);
void synchronizeOtherProperty(const QmlItemNode &qmlItemNode, const QByteArray &propertyName);
void synchronizeState(const QmlItemNode &qmlItemNode);
FormEditorItem* calulateNewParent(FormEditorItem *widget);
......
......@@ -135,9 +135,9 @@ QString ComponentView::descriptionForNode(const ModelNode &node) const
ModelNode parentNode = node.parentProperty().parentModelNode();
if (parentNode.id().isEmpty())
description = QString::fromUtf8(parentNode.simplifiedTypeName()) + QLatin1Char(' ');
description = parentNode.simplifiedTypeName() + ' ';
else
description = parentNode.id() + QLatin1Char(' ');
description = parentNode.id() + ' ';
description += QString::fromUtf8(node.parentProperty().name());
}
......
......@@ -546,8 +546,8 @@ static void appendNodeToEndOfTheRow(const ModelNode &modelNode, const ItemRow &n
if (modelNode.hasParentProperty()) {
NodeAbstractProperty parentProperty(modelNode.parentProperty());
ItemRow parentRow = treeModel->itemRowForNode(parentProperty.parentModelNode());
if (parentRow.propertyItems.contains(parentProperty.name())) {
QStandardItem *parentPropertyItem = parentRow.propertyItems.value(parentProperty.name());
if (parentRow.propertyItems.contains(QString::fromUtf8(parentProperty.name()))) {
QStandardItem *parentPropertyItem = parentRow.propertyItems.value(QString::fromUtf8(parentProperty.name()));
parentPropertyItem->appendRow(newItemRow.toList());
} else {
QStandardItem *parentDefaultPropertyItem = parentRow.idItem;
......@@ -768,7 +768,7 @@ void NavigatorTreeModel::handleItemLibraryImageDrop(const QMimeData *mimeData, i
bool foundTarget = computeTarget(rowModelIndex, this, &targetProperty, &targetRowNumber);
if (foundTarget) {
QString imageFileName = QString::fromUtf8(mimeData->data("application/vnd.bauhaus.libraryresource"));
QString imageFileName = QString::fromUtf8(mimeData->data(QLatin1String("application/vnd.bauhaus.libraryresource")));
QmlItemNode newQmlItemNode = QmlItemNode::createQmlItemNodeFromImage(m_view, imageFileName, QPointF(), targetProperty);
if (newQmlItemNode.isValid()) {
......
......@@ -70,7 +70,7 @@ public:
static QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType,
const QmlObjectNode &objectNode);
static QUrl getQmlFileUrl(const QString &relativeTypeName, const NodeMetaInfo &info = NodeMetaInfo());
static QUrl getQmlFileUrl(const TypeName &relativeTypeName, const NodeMetaInfo &info = NodeMetaInfo());
static QUrl getQmlUrlForModelNode(const ModelNode &modelNode, TypeName &className);
static bool checkIfUrlExists(const QUrl &url);
......@@ -88,11 +88,11 @@ private:
PropertyEditorView *propertyEditor);
void setupPropertyEditorValue(const PropertyName &name, PropertyEditorView *propertyEditor, const QString &type);
static QString qmlFileName(const NodeMetaInfo &nodeInfo);
static TypeName qmlFileName(const NodeMetaInfo &nodeInfo);
static QUrl fileToUrl(const QString &filePath);
static QString fileFromUrl(const QUrl &url);
static QString locateQmlFile(const NodeMetaInfo &info, const QString &relativePath);
static QString fixTypeNameForPanes(const QString &typeName);
static TypeName fixTypeNameForPanes(const TypeName &typeName);
private:
Quick2PropertyEditorView *m_view;
......
......@@ -139,7 +139,7 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value)
setValue(newValue);
m_isBound = false;
emit valueChanged(name(), value);
emit valueChanged(nameAsQString(), value);
emit valueChangedQml();
emit isBoundChanged();
}
......@@ -175,7 +175,7 @@ void PropertyEditorValue::setExpressionWithEmit(const QString &expression)
{
if ( m_expression != expression) {
setExpression(expression);
emit expressionChanged(name());
emit expressionChanged(nameAsQString());
}
}
......@@ -214,6 +214,11 @@ QmlDesigner::PropertyName PropertyEditorValue::name() const
return m_name;
}
QString PropertyEditorValue::nameAsQString() const
{
return QString::fromUtf8(m_name);
}
void PropertyEditorValue::setName(const QmlDesigner::PropertyName &name)
{
m_name = name;
......@@ -274,7 +279,7 @@ void PropertyEditorValue::resetValue()
if (m_value.isValid() || isBound()) {
m_value = QVariant();
m_isBound = false;
emit valueChanged(name(), QVariant());
emit valueChanged(nameAsQString(), QVariant());
}
}
......@@ -315,7 +320,7 @@ QString PropertyEditorNodeWrapper::type()
if (!(m_modelNode.isValid()))
return QString();
return QString::fromUtf8(m_modelNode.simplifiedTypeName());
return m_modelNode.simplifiedTypeName();
}
......@@ -381,7 +386,7 @@ void PropertyEditorNodeWrapper::changeValue(const QString &propertyName)
if (m_modelNode.isValid()) {
QmlDesigner::QmlObjectNode qmlObjectNode(m_modelNode);
PropertyEditorValue *valueObject = qvariant_cast<PropertyEditorValue *>(m_valuesPropertyMap.value(name));
PropertyEditorValue *valueObject = qvariant_cast<PropertyEditorValue *>(m_valuesPropertyMap.value(QString::fromLatin1(name)));
if (valueObject->value().isValid())
qmlObjectNode.setVariantProperty(name, valueObject->value());
......@@ -407,7 +412,7 @@ void PropertyEditorNodeWrapper::setup()
valueObject->setName(propertyName);
valueObject->setValue(qmlObjectNode.instanceValue(propertyName));
connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_valuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
m_valuesPropertyMap.insert(propertyName, QVariant::fromValue(valueObject));
m_valuesPropertyMap.insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
}
}
}
......
......@@ -84,7 +84,7 @@ class PropertyEditorValue : public QObject
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged FINAL)
Q_PROPERTY(bool isTranslated READ isTranslated NOTIFY expressionChanged FINAL)
Q_PROPERTY(QString name READ name FINAL)
Q_PROPERTY(QString name READ nameAsQString FINAL)
Q_PROPERTY(PropertyEditorNodeWrapper* complexNode READ complexNode NOTIFY complexNodeChanged FINAL)
public:
......@@ -114,6 +114,7 @@ public:
bool isTranslated() const;
QmlDesigner::PropertyName name() const;
QString nameAsQString() const;
void setName(const QmlDesigner::PropertyName &name);
QmlDesigner::ModelNode modelNode() const;
......
......@@ -102,7 +102,7 @@ void PropertyEditorView::setupPane(const TypeName &typeName)
{
NodeMetaInfo metaInfo = model()->metaInfo(typeName);
QUrl qmlFile = PropertyEditorQmlBackend::getQmlFileUrl(QStringLiteral("Qt/ItemPane"), metaInfo);
QUrl qmlFile = PropertyEditorQmlBackend::getQmlFileUrl("Qt/ItemPane", metaInfo);
QUrl qmlSpecificsFile;
qmlSpecificsFile = PropertyEditorQmlBackend::getQmlFileUrl(typeName + "Specifics", metaInfo);
......@@ -144,7 +144,7 @@ void PropertyEditorView::changeValue(const QString &name)
return;
if (propertyName == "id") {
PropertyEditorValue *value = m_qmlBackEndForCurrentType->propertyValueForName(propertyName);
PropertyEditorValue *value = m_qmlBackEndForCurrentType->propertyValueForName(QString::fromUtf8(propertyName));
const QString newId = value->value().toString();
if (newId == m_selectedNode.id())
......@@ -166,7 +166,7 @@ void PropertyEditorView::changeValue(const QString &name)
PropertyName underscoreName(propertyName);
underscoreName.replace('.', '_');
PropertyEditorValue *value = m_qmlBackEndForCurrentType->propertyValueForName(underscoreName);
PropertyEditorValue *value = m_qmlBackEndForCurrentType->propertyValueForName(QString::fromLatin1(underscoreName));
if (value ==0)
return;
......@@ -242,7 +242,7 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
underscoreName.replace('.', '_');
QmlObjectNode qmlObjectNode(m_selectedNode);
PropertyEditorValue *value = m_qmlBackEndForCurrentType->propertyValueForName(underscoreName);
PropertyEditorValue *value = m_qmlBackEndForCurrentType->propertyValueForName(QString::fromLatin1(underscoreName));
if (!value) {
qWarning() << "PropertyEditor::changeExpression no value for " << underscoreName;
......@@ -257,8 +257,9 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
return;
}
} else if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(name) == "bool") {
if (value->expression().compare("false", Qt::CaseInsensitive) == 0 || value->expression().compare("true", Qt::CaseInsensitive) == 0) {
if (value->expression().compare("true", Qt::CaseInsensitive) == 0)
if (value->expression().compare(QLatin1String("false"), Qt::CaseInsensitive) == 0
|| value->expression().compare(QLatin1String("true"), Qt::CaseInsensitive) == 0) {
if (value->expression().compare(QLatin1String("true"), Qt::CaseInsensitive) == 0)
qmlObjectNode.setVariantProperty(name, true);
else
qmlObjectNode.setVariantProperty(name, false);
......@@ -376,7 +377,7 @@ void PropertyEditorView::setupQmlBackend()
foreach (const NodeMetaInfo &metaInfo, hierarchy) {
if (PropertyEditorQmlBackend::checkIfUrlExists(qmlSpecificsFile))
break;
qmlSpecificsFile = PropertyEditorQmlBackend::getQmlFileUrl(metaInfo.typeName() + QStringLiteral("Specifics"), metaInfo);
qmlSpecificsFile = PropertyEditorQmlBackend::getQmlFileUrl(metaInfo.typeName() + "Specifics", metaInfo);
diffClassName = metaInfo.typeName();
}
}
......
......@@ -110,7 +110,7 @@ Exception::Exception(int line,
for (int i = 0; i < nSize; i++)
{
m_backTrace.append(QString("%1\n").arg(symbols[i]));
m_backTrace.append(QString("%1\n").arg(QLatin1String(symbols[i])));
}
free(symbols);
......
......@@ -156,7 +156,7 @@ void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializ
newPropertyTemplate.prepend(QLatin1Char('\n'));
}
const QString newPropertyText = addIndentation(newPropertyTemplate.arg(m_name, m_value), depth);
const QString newPropertyText = addIndentation(newPropertyTemplate.arg(QString::fromLatin1(m_name), m_value), depth);
replace(endOfPreviousMember.end(), 0, newPropertyText);
setDidRewriting(true);
......
......@@ -101,7 +101,7 @@ private:
UiObjectMember *member = iter->member;
if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member)) {
if (toString(arrayBinding->qualifiedId) == targetPropertyName) {
if (toString(arrayBinding->qualifiedId) == QString::fromUtf8(targetPropertyName)) {
appendToArray(arrayBinding);
setDidRewriting(true);
......@@ -112,7 +112,7 @@ private:
{ // insert (create) a UiObjectBinding:
UiObjectMemberList *insertAfter = searchMemberToInsertAfter(ast->members, targetPropertyName, propertyOrder);
moveInfo.prefixToInsert = QStringLiteral("\n") + targetPropertyName + (targetIsArrayBinding ? QStringLiteral(": [") : QStringLiteral(": "));
moveInfo.prefixToInsert = QStringLiteral("\n") + QString::fromUtf8(targetPropertyName) + (targetIsArrayBinding ? QStringLiteral(": [") : QStringLiteral(": "));
moveInfo.suffixToInsert = targetIsArrayBinding ? QStringLiteral("\n]") : QStringLiteral("");
if (insertAfter && insertAfter->member)
......
......@@ -85,7 +85,7 @@ bool QmlRefactoring::addToArrayMemberList(int parentLocation, const PropertyName
if (parentLocation < 0)
return false;
AddArrayMemberVisitor visit(*textModifier, (quint32) parentLocation, propertyName, content);
AddArrayMemberVisitor visit(*textModifier, (quint32) parentLocation, QString::fromUtf8(propertyName), content);
visit.setConvertObjectBindingIntoArrayBinding(true);
return visit(qmlDocument->qmlProgram());
}
......@@ -117,7 +117,11 @@ bool QmlRefactoring::changeProperty(int parentLocation, const PropertyName &name
if (parentLocation < 0)
return false;
ChangePropertyVisitor visit(*textModifier, (quint32) parentLocation, name, value, propertyType);
ChangePropertyVisitor visit(*textModifier,
(quint32) parentLocation,
QString::fromUtf8(name),
value,
propertyType);
return visit(qmlDocument->qmlProgram());
}
......@@ -168,6 +172,6 @@ bool QmlRefactoring::removeProperty(int parentLocation, const PropertyName &name
if (parentLocation < 0 || name.isEmpty())
return false;
RemovePropertyVisitor visit(*textModifier, (quint32) parentLocation, name);
RemovePropertyVisitor visit(*textModifier, (quint32) parentLocation, QString::fromUtf8(name));
return visit(qmlDocument->qmlProgram());
}
......@@ -319,7 +319,7 @@ QmlJS::AST::UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(QmlJS::AS
idx = propertyOrder.size() - 1;
for (; idx > 0; --idx) {
const QString prop = propertyOrder.at(idx - 1);
const QString prop = QString::fromLatin1(propertyOrder.at(idx - 1));
QmlJS::AST::UiObjectMemberList *candidate = orderedMembers.value(prop, 0);
if (candidate != 0)
return candidate;
......
......@@ -98,7 +98,7 @@ class QMLDESIGNERCORE_EXPORT ItemLibraryInfo : public QObject
public:
QList<ItemLibraryEntry> entries() const;
QList<ItemLibraryEntry> entriesForType(const QString &typeName, int majorVersion, int minorVersion) const;
QList<ItemLibraryEntry> entriesForType(const QByteArray &typeName, int majorVersion, int minorVersion) const;
ItemLibraryEntry entry(const QString &name) const;
void addEntry(const ItemLibraryEntry &entry, bool overwriteDuplicate = false);
......
......@@ -93,7 +93,7 @@ public:
ModelNode& operator=(const ModelNode &other);
TypeName type() const;
TypeName simplifiedTypeName() const;
QString simplifiedTypeName() const;
int minorVersion() const;
int majorVersion() const;
......
......@@ -82,7 +82,7 @@ public:
QList<NodeMetaInfo> superClasses() const;
NodeMetaInfo directSuperClass() const;
QList<TypeName> superClassNames() const;
QStringList superClassNames() const;
bool defaultPropertyIsComponent() const;
......
......@@ -110,7 +110,7 @@ public:
QPixmap instanceRenderPixmap() const;
QPixmap instanceBlurredRenderPixmap() const;
TypeName simplifiedTypeName() const;
QString simplifiedTypeName() const;
const QList<QmlItemNode> allDirectSubModelNodes() const;
const QList<QmlItemNode> allSubModelNodes() const;
......
......@@ -540,7 +540,7 @@ void NodeInstanceServerProxy::printEditorProcessOutput()
while (m_qmlPuppetEditorProcess && m_qmlPuppetEditorProcess->canReadLine()) {
QByteArray line = m_qmlPuppetEditorProcess->readLine();
line.chop(1);
qDebug().nospace() << "Editor Puppet: " << qPrintable(line);
qDebug().nospace() << "Editor Puppet: " << line;
}
qDebug() << "\n";
}
......@@ -550,7 +550,7 @@ void NodeInstanceServerProxy::printPreviewProcessOutput()
while (m_qmlPuppetPreviewProcess && m_qmlPuppetPreviewProcess->canReadLine()) {
QByteArray line = m_qmlPuppetPreviewProcess->readLine();
line.chop(1);
qDebug().nospace() << "Preview Puppet: " << qPrintable(line);
qDebug().nospace() << "Preview Puppet: " << line;
}
qDebug() << "\n";
}
......@@ -560,7 +560,7 @@ void NodeInstanceServerProxy::printRenderProcessOutput()
while (m_qmlPuppetRenderProcess && m_qmlPuppetRenderProcess->canReadLine()) {
QByteArray line = m_qmlPuppetRenderProcess->readLine();
line.chop(1);
qDebug().nospace() << "Render Puppet: " << qPrintable(line);
qDebug().nospace() << "Render Puppet: " << line;
}
qDebug() << "\n";
......
......@@ -124,7 +124,7 @@ NodeInstanceView::~NodeInstanceView()
bool isSkippedRootNode(const ModelNode &node)
{
static QStringList skipList = QStringList() << "Qt.ListModel" << "QtQuick.ListModel" << "Qt.ListModel" << "QtQuick.ListModel";
static PropertyNameList skipList = PropertyNameList() << "Qt.ListModel" << "QtQuick.ListModel" << "Qt.ListModel" << "QtQuick.ListModel";
if (skipList.contains(node.type()))
return true;
......@@ -135,7 +135,7 @@ bool isSkippedRootNode(const ModelNode &node)
bool isSkippedNode(const ModelNode &node)
{
static QStringList skipList = QStringList() << "QtQuick.XmlRole" << "Qt.XmlRole" << "QtQuick.ListElement" << "Qt.ListElement";
static PropertyNameList skipList = PropertyNameList() << "QtQuick.XmlRole" << "Qt.XmlRole" << "QtQuick.ListElement" << "Qt.ListElement";
if (skipList.contains(node.type()))
return true;
......@@ -318,7 +318,7 @@ void NodeInstanceView::propertiesAboutToBeRemoved(const QList<AbstractProperty>&
nodeInstanceServer()->removeProperties(createRemovePropertiesCommand(nonNodePropertyList));
foreach (const AbstractProperty &property, propertyList) {
const QString &name = property.name();
const PropertyName &name = property.name();
if (name == "anchors.fill") {
resetHorizontalAnchors(property.parentModelNode());
resetVerticalAnchors(property.parentModelNode());
......
......@@ -170,7 +170,7 @@ void ItemLibraryEntry::setLibraryEntryIconPath(const QString &iconPath)
m_data->libraryEntryIconPath = iconPath;
}
static QString getSourceForUrl(const QString &fileURl)
static QByteArray getSourceForUrl(const QString &fileURl)
{
Utils::FileReader fileReader;
......@@ -184,7 +184,7 @@ void ItemLibraryEntry::setQmlPath(const QString &qml)
{
m_data->qml = qml;
m_data->qmlSource = getSourceForUrl(qml);
m_data->qmlSource = QString::fromUtf8(getSourceForUrl(qml));
}
void ItemLibraryEntry::setRequiredImport(const QString &requiredImport)
......@@ -264,7 +264,7 @@ ItemLibraryInfo::ItemLibraryInfo(QObject *parent)
QList<ItemLibraryEntry> ItemLibraryInfo::entriesForType(const QString &typeName, int majorVersion, int minorVersion) const
QList<ItemLibraryEntry> ItemLibraryInfo::entriesForType(const QByteArray &typeName, int majorVersion, int minorVersion) const
{
QList<ItemLibraryEntry> entries;
......
......@@ -467,12 +467,12 @@ QString AbstractView::generateNewId(const QString &prefixName) const
{
int counter = 1;
QString newId = QString("%1%2").arg(firstCharToLower(prefixName)).arg(counter);
QString newId = QString(QStringLiteral("%1%2")).arg(firstCharToLower(prefixName)).arg(counter);
newId.remove(QRegExp(QStringLiteral("[^a-zA-Z0-9_]")));
while (hasId(newId)) {
counter += 1;
newId = QString("%1%2").arg(firstCharToLower(prefixName)).arg(counter);
newId = QString(QStringLiteral("%1%2")).arg(firstCharToLower(prefixName)).arg(counter);
newId.remove(QRegExp(QStringLiteral("[^a-zA-Z0-9_]")));
}
......
......@@ -96,7 +96,7 @@ static ModelNode resolveBinding(const QString &binding, ModelNode currentNode, A
while (!element.isEmpty())
{
if (currentNode.isValid()) {
if (element == "parent") {
if (element == QLatin1String("parent")) {
if (currentNode.hasParentProperty())
currentNode = currentNode.parentProperty().toNodeAbstractProperty().parentModelNode();
else
......@@ -200,7 +200,7 @@ bool BindingProperty::isAliasExport() const
return parentModelNode() == parentModelNode().view()->rootModelNode()
&& isDynamic()
&& dynamicTypeName() == "alias"
&& name() == expression()
&& name() == expression().toUtf8()
&& parentModelNode().view()->modelNodeForId(expression()).isValid();
}
......
......@@ -311,16 +311,16 @@ void ModelPrivate::changeNodeId(const InternalNode::Pointer& internalNodePointer
}
}
void ModelPrivate::checkPropertyName(const QString &propertyName)
void ModelPrivate::checkPropertyName(const PropertyName &propertyName)
{
if (propertyName.isEmpty()) {
Q_ASSERT_X(propertyName.isEmpty(), Q_FUNC_INFO, "empty property name");
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, "<empty property name>");
}
if (propertyName == QLatin1String("id")) {
Q_ASSERT_X(propertyName != QLatin1String("id"), Q_FUNC_INFO, "cannot add property id");
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, propertyName.toUtf8());
if (propertyName == "id") {
Q_ASSERT_X(propertyName != "id", Q_FUNC_INFO, "cannot add property id");
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, propertyName);
}
}
......
......@@ -194,7 +194,7 @@ public:
void setDynamicBindingProperty(const InternalNodePointer &internalNodePointer, const PropertyName &name, const TypeName &dynamicPropertyType, const QString &expression);
void reparentNode(const InternalNodePointer &internalNodePointer, const PropertyName &name, const InternalNodePointer &internalNodeToBeAppended, bool list = true);
void changeNodeOrder(const InternalNodePointer &internalParentNode, const PropertyName &listPropertyName, int from, int to);
void checkPropertyName(const QString &propertyName);
void checkPropertyName(const PropertyName &propertyName);
void clearParent(const InternalNodePointer &internalNodePointer);
void changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion);
void setScriptFunctions(const InternalNodePointer &internalNode, const QStringList &scriptFunctionList);
......
......@@ -136,7 +136,7 @@ QString ModelNode::id() const
QString ModelNode::validId()
{
if (id().isEmpty())
setIdWithRefactoring(view()->generateNewId(QString::fromUtf8(simplifiedTypeName())));
setIdWithRefactoring(view()->generateNewId(simplifiedTypeName()));
return id();
}
......@@ -236,14 +236,14 @@ int ModelNode::majorVersion() const
}
/*! \return the short-hand type name of the node. */
TypeName ModelNode::simplifiedTypeName() const
QString ModelNode::simplifiedTypeName() const
{
if (!isValid()) {
Q_ASSERT_X(isValid(), Q_FUNC_INFO, "model node is invalid");
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
}
return type().split('.').last();
return QString::fromUtf8(type().split('.').last());
}
/*! \brief Returns whether the node is valid
......@@ -584,7 +584,7 @@ void ModelNode::removeProperty(const PropertyName &name) const
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
model()->d->checkPropertyName(QString::fromUtf8(name));
model()->d->checkPropertyName(name);
if (internalNode()->hasProperty(name))
model()->d->removeProperty(internalNode()->property(name));
......
......@@ -48,25 +48,25 @@ static PropertyName lineTypeToString(AnchorLineType lineType)
}
}
static AnchorLineType propertyNameToLineType(const QString & string)
static AnchorLineType propertyNameToLineType(const PropertyName & name)
{
if (string == QStringLiteral("left"))
if (name == "left")
return AnchorLineLeft;
else if (string == QStringLiteral("top"))
else if (name == "top")
return AnchorLineTop;
else if (string == QStringLiteral("right"))