QmlPuppet: Fix some deprecation warnings

Crc/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp

Change-Id: I83342da2a9015ac1a8ba15d2fa10626ef00f5e0c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
hjk
2024-06-05 09:37:55 +02:00
parent 74e4e1053a
commit 5f0b9cd5ff
2 changed files with 32 additions and 32 deletions

View File

@@ -541,34 +541,34 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
{ {
NANOTRACE_SCOPE_ARGS("Update", "dispatchCommand", {"name", command.typeName()}); NANOTRACE_SCOPE_ARGS("Update", "dispatchCommand", {"name", command.typeName()});
static const int createInstancesCommandType = QMetaType::type("CreateInstancesCommand"); static const int createInstancesCommandType = QMetaType::fromName("CreateInstancesCommand").id();
static const int update3dViewStateCommand = QMetaType::type("Update3dViewStateCommand"); static const int update3dViewStateCommand = QMetaType::fromName("Update3dViewStateCommand").id();
static const int changeFileUrlCommandType = QMetaType::type("ChangeFileUrlCommand"); static const int changeFileUrlCommandType = QMetaType::fromName("ChangeFileUrlCommand").id();
static const int createSceneCommandType = QMetaType::type("CreateSceneCommand"); static const int createSceneCommandType = QMetaType::fromName("CreateSceneCommand").id();
static const int clearSceneCommandType = QMetaType::type("ClearSceneCommand"); static const int clearSceneCommandType = QMetaType::fromName("ClearSceneCommand").id();
static const int removeInstancesCommandType = QMetaType::type("RemoveInstancesCommand"); static const int removeInstancesCommandType = QMetaType::fromName("RemoveInstancesCommand").id();
static const int removePropertiesCommandType = QMetaType::type("RemovePropertiesCommand"); static const int removePropertiesCommandType = QMetaType::fromName("RemovePropertiesCommand").id();
static const int changeBindingsCommandType = QMetaType::type("ChangeBindingsCommand"); static const int changeBindingsCommandType = QMetaType::fromName("ChangeBindingsCommand").id();
static const int changeValuesCommandType = QMetaType::type("ChangeValuesCommand"); static const int changeValuesCommandType = QMetaType::fromName("ChangeValuesCommand").id();
static const int changeAuxiliaryCommandType = QMetaType::type("ChangeAuxiliaryCommand"); static const int changeAuxiliaryCommandType = QMetaType::fromName("ChangeAuxiliaryCommand").id();
static const int reparentInstancesCommandType = QMetaType::type("ReparentInstancesCommand"); static const int reparentInstancesCommandType = QMetaType::fromName("ReparentInstancesCommand").id();
static const int changeIdsCommandType = QMetaType::type("ChangeIdsCommand"); static const int changeIdsCommandType = QMetaType::fromName("ChangeIdsCommand").id();
static const int changeStateCommandType = QMetaType::type("ChangeStateCommand"); static const int changeStateCommandType = QMetaType::fromName("ChangeStateCommand").id();
static const int completeComponentCommandType = QMetaType::type("CompleteComponentCommand"); static const int completeComponentCommandType = QMetaType::fromName("CompleteComponentCommand").id();
static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand"); static const int synchronizeCommandType = QMetaType::fromName("SynchronizeCommand").id();
static const int changeNodeSourceCommandType = QMetaType::type("ChangeNodeSourceCommand"); static const int changeNodeSourceCommandType = QMetaType::fromName("ChangeNodeSourceCommand").id();
static const int removeSharedMemoryCommandType = QMetaType::type("RemoveSharedMemoryCommand"); static const int removeSharedMemoryCommandType = QMetaType::fromName("RemoveSharedMemoryCommand").id();
static const int tokenCommandType = QMetaType::type("TokenCommand"); static const int tokenCommandType = QMetaType::fromName("TokenCommand").id();
static const int endPuppetCommandType = QMetaType::type("EndPuppetCommand"); static const int endPuppetCommandType = QMetaType::fromName("EndPuppetCommand").id();
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand"); static const int changeSelectionCommandType = QMetaType::fromName("ChangeSelectionCommand").id();
static const int inputEventCommandType = QMetaType::type("InputEventCommand"); static const int inputEventCommandType = QMetaType::fromName("InputEventCommand").id();
static const int view3DActionCommandType = QMetaType::type("View3DActionCommand"); static const int view3DActionCommandType = QMetaType::fromName("View3DActionCommand").id();
static const int requestModelNodePreviewImageCommandType = QMetaType::type("RequestModelNodePreviewImageCommand"); static const int requestModelNodePreviewImageCommandType = QMetaType::fromName("RequestModelNodePreviewImageCommand").id();
static const int changeLanguageCommand = QMetaType::type("ChangeLanguageCommand"); static const int changeLanguageCommand = QMetaType::fromName("ChangeLanguageCommand").id();
static const int changePreviewImageSizeCommand = QMetaType::type( static const int changePreviewImageSizeCommand = QMetaType::fromName(
"ChangePreviewImageSizeCommand"); "ChangePreviewImageSizeCommand").id();
static const int startNanotraceCommandType = QMetaType::type("StartNanotraceCommand"); static const int startNanotraceCommandType = QMetaType::fromName("StartNanotraceCommand").id();
static const int endNanotraceCommandType = QMetaType::type("EndNanotraceCommand"); static const int endNanotraceCommandType = QMetaType::fromName("EndNanotraceCommand").id();
const int commandType = command.typeId(); const int commandType = command.typeId();

View File

@@ -471,7 +471,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
QVariant oldValue = property.read(); QVariant oldValue = property.read();
if (oldValue.typeId() == QVariant::Url) { if (oldValue.typeId() == QMetaType::QUrl) {
QUrl url = oldValue.toUrl(); QUrl url = oldValue.toUrl();
QString path = url.toLocalFile(); QString path = url.toLocalFile();
if (QFileInfo::exists(path) && nodeInstanceServer() && !path.isEmpty()) if (QFileInfo::exists(path) && nodeInstanceServer() && !path.isEmpty())
@@ -488,7 +488,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
qDebug() << "ObjectNodeInstance.setPropertyVariant: Cannot be written: " << object() << name << adjustedValue; qDebug() << "ObjectNodeInstance.setPropertyVariant: Cannot be written: " << object() << name << adjustedValue;
QVariant newValue = property.read(); QVariant newValue = property.read();
if (newValue.typeId() == QVariant::Url) { if (newValue.typeId() == QMetaType::QUrl) {
QUrl url = newValue.toUrl(); QUrl url = newValue.toUrl();
QString path = url.toLocalFile(); QString path = url.toLocalFile();
if (QFileInfo::exists(path) && nodeInstanceServer() && !path.isEmpty()) if (QFileInfo::exists(path) && nodeInstanceServer() && !path.isEmpty())
@@ -578,7 +578,7 @@ void ObjectNodeInstance::refreshProperty(const PropertyName &name)
else else
property.write(resetValue(name)); property.write(resetValue(name));
if (oldValue.typeId() == QVariant::Url) { if (oldValue.typeId() == QMetaType::QUrl) {
QByteArray key = oldValue.toUrl().toEncoded(QUrl::UrlFormattingOption(0x100)); QByteArray key = oldValue.toUrl().toEncoded(QUrl::UrlFormattingOption(0x100));
QString pixmapKey = QString::fromUtf8(key.constData(), key.size()); QString pixmapKey = QString::fromUtf8(key.constData(), key.size());
QPixmapCache::remove(pixmapKey); QPixmapCache::remove(pixmapKey);
@@ -623,7 +623,7 @@ QVariant ObjectNodeInstance::property(const PropertyName &name) const
return QVariant::fromValue<Enumeration>(Enumeration(me.scope(), me.valueToKey(value.toInt()))); return QVariant::fromValue<Enumeration>(Enumeration(me.scope(), me.valueToKey(value.toInt())));
} }
if (property.propertyType() == QVariant::Url) { if (property.propertyType() == QMetaType::QUrl) {
QUrl url = property.read().toUrl(); QUrl url = property.read().toUrl();
if (url.isEmpty()) if (url.isEmpty())
return QVariant(); return QVariant();