forked from qt-creator/qt-creator
QmlDesigner: Qt 6.8 fixes
Task-number: QDS-13175 Change-Id: Ic7ac18974c7e3e08758eed0ca50376737d919196 Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
@@ -13,12 +13,12 @@ PropertyValueContainer::PropertyValueContainer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
PropertyValueContainer::PropertyValueContainer(qint32 instanceId,
|
PropertyValueContainer::PropertyValueContainer(qint32 instanceId,
|
||||||
const PropertyName &name,
|
PropertyNameView name,
|
||||||
const QVariant &value,
|
const QVariant &value,
|
||||||
const TypeName &dynamicTypeName,
|
const TypeName &dynamicTypeName,
|
||||||
AuxiliaryDataType auxiliaryDataType)
|
AuxiliaryDataType auxiliaryDataType)
|
||||||
: m_instanceId(instanceId)
|
: m_instanceId(instanceId)
|
||||||
, m_name(name)
|
, m_name(name.toByteArray())
|
||||||
, m_value(value)
|
, m_value(value)
|
||||||
, m_dynamicTypeName(dynamicTypeName)
|
, m_dynamicTypeName(dynamicTypeName)
|
||||||
, m_auxiliaryDataType{auxiliaryDataType}
|
, m_auxiliaryDataType{auxiliaryDataType}
|
||||||
|
@@ -11,13 +11,14 @@
|
|||||||
#include "nodeinstanceglobal.h"
|
#include "nodeinstanceglobal.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
using PropertyNameView = QByteArrayView;
|
||||||
|
|
||||||
class PropertyValueContainer
|
class PropertyValueContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertyValueContainer();
|
PropertyValueContainer();
|
||||||
PropertyValueContainer(qint32 instanceId,
|
PropertyValueContainer(qint32 instanceId,
|
||||||
const PropertyName &name,
|
PropertyNameView name,
|
||||||
const QVariant &value,
|
const QVariant &value,
|
||||||
const TypeName &dynamicTypeName,
|
const TypeName &dynamicTypeName,
|
||||||
AuxiliaryDataType auxiliaryDataType = AuxiliaryDataType::None);
|
AuxiliaryDataType auxiliaryDataType = AuxiliaryDataType::None);
|
||||||
|
@@ -72,12 +72,13 @@ public:
|
|||||||
|
|
||||||
constexpr_string operator std::string() const { return std::string(data(), size()); }
|
constexpr_string operator std::string() const { return std::string(data(), size()); }
|
||||||
|
|
||||||
explicit operator QString() const
|
explicit operator QString() const { return QString::fromUtf8(data(), int(size())); }
|
||||||
{
|
|
||||||
return QString::fromUtf8(data(), int(size()));
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit operator QByteArray() const { return QByteArray(data(), int(size())); }
|
operator QByteArrayView() const { return QByteArrayView(data(), Utils::ssize(*this)); }
|
||||||
|
|
||||||
|
explicit operator QByteArray() const { return QByteArrayView{*this}.toByteArray(); }
|
||||||
|
|
||||||
|
QByteArray toByteArray() const { return QByteArrayView{*this}.toByteArray(); }
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||||
explicit operator QLatin1StringView() const noexcept
|
explicit operator QLatin1StringView() const noexcept
|
||||||
|
@@ -10,8 +10,6 @@
|
|||||||
#include "effectutils.h"
|
#include "effectutils.h"
|
||||||
#include "propertyhandler.h"
|
#include "propertyhandler.h"
|
||||||
|
|
||||||
//#include "qmldesigner/designercore/imagecache/midsizeimagecacheprovider.h"
|
|
||||||
#include "theme.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
@@ -20,6 +18,7 @@
|
|||||||
#include <qmldesigner/documentmanager.h>
|
#include <qmldesigner/documentmanager.h>
|
||||||
#include <qmldesigner/qmldesignerconstants.h>
|
#include <qmldesigner/qmldesignerconstants.h>
|
||||||
#include <qmldesigner/qmldesignerplugin.h>
|
#include <qmldesigner/qmldesignerplugin.h>
|
||||||
|
#include <qmldesigner/components/componentcore/theme.h>
|
||||||
#include <studioquickwidget.h>
|
#include <studioquickwidget.h>
|
||||||
|
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
|
@@ -396,7 +396,7 @@ void DebugView::auxiliaryDataChanged(const ModelNode &node,
|
|||||||
|
|
||||||
message << node;
|
message << node;
|
||||||
message << key.type;
|
message << key.type;
|
||||||
message << QByteArray{key.name};
|
message << key.name.toByteArray();
|
||||||
message << data.toString();
|
message << data.toString();
|
||||||
|
|
||||||
log("::auxiliaryDataChanged:", string);
|
log("::auxiliaryDataChanged:", string);
|
||||||
|
@@ -281,7 +281,7 @@ void MaterialEditorQmlBackend::emitSelectionChanged()
|
|||||||
void MaterialEditorQmlBackend::setValueforAuxiliaryProperties(const QmlObjectNode &qmlObjectNode,
|
void MaterialEditorQmlBackend::setValueforAuxiliaryProperties(const QmlObjectNode &qmlObjectNode,
|
||||||
AuxiliaryDataKeyView key)
|
AuxiliaryDataKeyView key)
|
||||||
{
|
{
|
||||||
const PropertyName propertyName = auxNamePostFix(PropertyName(key.name));
|
const PropertyName propertyName = auxNamePostFix(key.name.toByteArray());
|
||||||
setValue(qmlObjectNode, propertyName, qmlObjectNode.modelNode().auxiliaryDataWithDefault(key));
|
setValue(qmlObjectNode, propertyName, qmlObjectNode.modelNode().auxiliaryDataWithDefault(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -126,7 +126,7 @@ void PropertyEditorQmlBackend::setupPropertyEditorValue(const PropertyName &name
|
|||||||
namespace {
|
namespace {
|
||||||
PropertyName auxNamePostFix(Utils::SmallStringView propertyName)
|
PropertyName auxNamePostFix(Utils::SmallStringView propertyName)
|
||||||
{
|
{
|
||||||
return PropertyName(propertyName) + "__AUX";
|
return PropertyNameView(propertyName) + "__AUX";
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant properDefaultAuxiliaryProperties(const QmlObjectNode &qmlObjectNode,
|
QVariant properDefaultAuxiliaryProperties(const QmlObjectNode &qmlObjectNode,
|
||||||
|
@@ -276,7 +276,7 @@ void TextureEditorQmlBackend::emitSelectionChanged()
|
|||||||
void TextureEditorQmlBackend::setValueforAuxiliaryProperties(const QmlObjectNode &qmlObjectNode,
|
void TextureEditorQmlBackend::setValueforAuxiliaryProperties(const QmlObjectNode &qmlObjectNode,
|
||||||
AuxiliaryDataKeyView key)
|
AuxiliaryDataKeyView key)
|
||||||
{
|
{
|
||||||
const PropertyName propertyName = auxNamePostFix(PropertyName(key.name));
|
const PropertyName propertyName = auxNamePostFix(key.name.toByteArray());
|
||||||
setValue(qmlObjectNode, propertyName, qmlObjectNode.modelNode().auxiliaryDataWithDefault(key));
|
setValue(qmlObjectNode, propertyName, qmlObjectNode.modelNode().auxiliaryDataWithDefault(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -67,6 +67,7 @@
|
|||||||
#include <projectstorage/projectstorage.h>
|
#include <projectstorage/projectstorage.h>
|
||||||
|
|
||||||
#include <utils/hdrimage.h>
|
#include <utils/hdrimage.h>
|
||||||
|
#include <utils/smallstringview.h>
|
||||||
|
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
|
|
||||||
@@ -93,6 +94,7 @@
|
|||||||
#include <QPicture>
|
#include <QPicture>
|
||||||
#include <QTimerEvent>
|
#include <QTimerEvent>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
debug = false
|
debug = false
|
||||||
@@ -634,10 +636,11 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node,
|
|||||||
case AuxiliaryDataType::Document:
|
case AuxiliaryDataType::Document:
|
||||||
if ((key == lockedProperty || key == invisibleProperty) && hasInstanceForModelNode(node)) {
|
if ((key == lockedProperty || key == invisibleProperty) && hasInstanceForModelNode(node)) {
|
||||||
NodeInstance instance = instanceForModelNode(node);
|
NodeInstance instance = instanceForModelNode(node);
|
||||||
|
|
||||||
PropertyValueContainer container{instance.instanceId(),
|
PropertyValueContainer container{instance.instanceId(),
|
||||||
PropertyName{key.name},
|
key.name,
|
||||||
value,
|
value,
|
||||||
TypeName(),
|
{},
|
||||||
key.type};
|
key.type};
|
||||||
m_nodeInstanceServer->changeAuxiliaryValues({{container}});
|
m_nodeInstanceServer->changeAuxiliaryValues({{container}});
|
||||||
}
|
}
|
||||||
@@ -647,7 +650,7 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node,
|
|||||||
if (hasInstanceForModelNode(node)) {
|
if (hasInstanceForModelNode(node)) {
|
||||||
NodeInstance instance = instanceForModelNode(node);
|
NodeInstance instance = instanceForModelNode(node);
|
||||||
PropertyValueContainer container{instance.instanceId(),
|
PropertyValueContainer container{instance.instanceId(),
|
||||||
PropertyName{key.name},
|
key.name,
|
||||||
value,
|
value,
|
||||||
TypeName(),
|
TypeName(),
|
||||||
key.type};
|
key.type};
|
||||||
@@ -660,13 +663,13 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node,
|
|||||||
NodeInstance instance = instanceForModelNode(node);
|
NodeInstance instance = instanceForModelNode(node);
|
||||||
if (value.isValid()) {
|
if (value.isValid()) {
|
||||||
PropertyValueContainer container{instance.instanceId(),
|
PropertyValueContainer container{instance.instanceId(),
|
||||||
PropertyName{key.name},
|
key.name,
|
||||||
value,
|
value,
|
||||||
TypeName(),
|
TypeName(),
|
||||||
key.type};
|
key.type};
|
||||||
m_nodeInstanceServer->changeAuxiliaryValues({{container}});
|
m_nodeInstanceServer->changeAuxiliaryValues({{container}});
|
||||||
} else {
|
} else {
|
||||||
PropertyName name{key.name};
|
const PropertyName name = key.name.toByteArray();
|
||||||
if (node.hasVariantProperty(name)) {
|
if (node.hasVariantProperty(name)) {
|
||||||
PropertyValueContainer container(instance.instanceId(),
|
PropertyValueContainer container(instance.instanceId(),
|
||||||
name,
|
name,
|
||||||
|
@@ -4347,7 +4347,7 @@ PropertyName PropertyMetaInfo::name() const
|
|||||||
category(),
|
category(),
|
||||||
keyValue("property declaration id", m_id)};
|
keyValue("property declaration id", m_id)};
|
||||||
|
|
||||||
return PropertyName(Utils::SmallStringView(propertyData().name));
|
return propertyData().name.toQByteArray();
|
||||||
} else {
|
} else {
|
||||||
return propertyName();
|
return propertyName();
|
||||||
}
|
}
|
||||||
|
@@ -51,12 +51,12 @@ public:
|
|||||||
using Pointer = std::shared_ptr<InternalNode>;
|
using Pointer = std::shared_ptr<InternalNode>;
|
||||||
using WeakPointer = std::weak_ptr<InternalNode>;
|
using WeakPointer = std::weak_ptr<InternalNode>;
|
||||||
|
|
||||||
explicit InternalNode(TypeName typeName,
|
explicit InternalNode(TypeNameView typeName,
|
||||||
int majorVersion,
|
int majorVersion,
|
||||||
int minorVersion,
|
int minorVersion,
|
||||||
qint32 internalId,
|
qint32 internalId,
|
||||||
ModelTracing::Category::FlowTokenType flowTraceToken)
|
ModelTracing::Category::FlowTokenType flowTraceToken)
|
||||||
: typeName(std::move(typeName))
|
: typeName(typeName.toByteArray())
|
||||||
, majorVersion(majorVersion)
|
, majorVersion(majorVersion)
|
||||||
, minorVersion(minorVersion)
|
, minorVersion(minorVersion)
|
||||||
, isValid(true)
|
, isValid(true)
|
||||||
|
@@ -110,7 +110,7 @@ ModelPrivate::ModelPrivate(Model *model,
|
|||||||
changeImports(std::move(imports), {});
|
changeImports(std::move(imports), {});
|
||||||
|
|
||||||
m_rootInternalNode = createNode(
|
m_rootInternalNode = createNode(
|
||||||
TypeName{typeName}, -1, -1, {}, {}, {}, ModelNode::NodeWithoutSource, {}, true);
|
typeName, -1, -1, {}, {}, {}, ModelNode::NodeWithoutSource, {}, true);
|
||||||
|
|
||||||
m_currentStateNode = m_rootInternalNode;
|
m_currentStateNode = m_rootInternalNode;
|
||||||
m_currentTimelineNode = m_rootInternalNode;
|
m_currentTimelineNode = m_rootInternalNode;
|
||||||
@@ -299,7 +299,7 @@ void ModelPrivate::changeNodeType(const InternalNodePointer &node, const TypeNam
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InternalNodePointer ModelPrivate::createNode(const TypeName &typeName,
|
InternalNodePointer ModelPrivate::createNode(TypeNameView typeName,
|
||||||
int majorVersion,
|
int majorVersion,
|
||||||
int minorVersion,
|
int minorVersion,
|
||||||
const QList<QPair<PropertyName, QVariant>> &propertyList,
|
const QList<QPair<PropertyName, QVariant>> &propertyList,
|
||||||
|
@@ -125,7 +125,7 @@ public:
|
|||||||
const QUrl &fileUrl() const;
|
const QUrl &fileUrl() const;
|
||||||
void setFileUrl(const QUrl &url);
|
void setFileUrl(const QUrl &url);
|
||||||
|
|
||||||
InternalNodePointer createNode(const TypeName &typeName,
|
InternalNodePointer createNode(TypeNameView typeName,
|
||||||
int majorVersion,
|
int majorVersion,
|
||||||
int minorVersion,
|
int minorVersion,
|
||||||
const QList<QPair<PropertyName, QVariant>> &propertyList,
|
const QList<QPair<PropertyName, QVariant>> &propertyList,
|
||||||
|
Reference in New Issue
Block a user