forked from qt-creator/qt-creator
Fix more metatype related deprecation warnings
QT_DEPRECATED_VERSION_6_0 static int type(const QT_PREPEND_NAMESPACE(QByteArray) &typeName) Change-Id: I6a085c6d370b6d65193dc09d4318765de81a8ce3 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -283,7 +283,7 @@ QVariant ParseContext::readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttr
|
||||
}
|
||||
QVariant value;
|
||||
value.setValue(text);
|
||||
value.convert(QMetaType::type(type.toLatin1().constData()));
|
||||
value.convert(QMetaType::fromName(type.toLatin1().constData()));
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ void BakeLightsConnectionManager::setFinishedCallback(Callback callback)
|
||||
void BakeLightsConnectionManager::dispatchCommand(const QVariant &command,
|
||||
ConnectionManagerInterface::Connection &)
|
||||
{
|
||||
static const int commandType = QMetaType::type("PuppetToCreatorCommand");
|
||||
static const int commandType = QMetaType::fromName("PuppetToCreatorCommand").id();
|
||||
|
||||
if (command.typeId() == commandType) {
|
||||
auto cmd = command.value<PuppetToCreatorCommand>();
|
||||
|
@@ -45,7 +45,7 @@ bool ImageCacheConnectionManager::waitForCapturedData()
|
||||
void ImageCacheConnectionManager::dispatchCommand(const QVariant &command,
|
||||
ConnectionManagerInterface::Connection &)
|
||||
{
|
||||
static const int capturedDataCommandType = QMetaType::type("CapturedDataCommand");
|
||||
static const int capturedDataCommandType = QMetaType::fromName("CapturedDataCommand").id();
|
||||
|
||||
if (command.typeId() == capturedDataCommandType) {
|
||||
m_captureCallback(command.value<CapturedDataCommand>().image);
|
||||
|
@@ -107,8 +107,8 @@ void BaseConnectionManager::readDataStream(Connection &connection)
|
||||
connection.blockSize = 0;
|
||||
|
||||
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
|
||||
if (command.typeId() != QMetaType::type("PuppetAliveCommand")) {
|
||||
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) {
|
||||
if (command.typeId() != QMetaType::fromName("PuppetAliveCommand").id()) {
|
||||
if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
|
||||
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
|
||||
NANOTRACE_INSTANT_ARGS("Sync", "readCommand",
|
||||
{"name", cmd.name().toStdString()},
|
||||
|
@@ -68,7 +68,7 @@ void InteractiveConnectionManager::showCannotConnectToPuppetWarningAndSwitchToEd
|
||||
|
||||
void InteractiveConnectionManager::dispatchCommand(const QVariant &command, Connection &connection)
|
||||
{
|
||||
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
|
||||
static const int puppetAliveCommandType = QMetaType::fromName("PuppetAliveCommand").id();
|
||||
|
||||
if (command.typeId() == puppetAliveCommandType) {
|
||||
puppetAlive(connection);
|
||||
|
@@ -93,18 +93,18 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
|
||||
{
|
||||
NANOTRACE_SCOPE_ARGS("Update", "dispatchCommand", {"name", command.typeName()});
|
||||
|
||||
static const int informationChangedCommandType = QMetaType::type("InformationChangedCommand");
|
||||
static const int valuesChangedCommandType = QMetaType::type("ValuesChangedCommand");
|
||||
static const int valuesModifiedCommandType = QMetaType::type("ValuesModifiedCommand");
|
||||
static const int pixmapChangedCommandType = QMetaType::type("PixmapChangedCommand");
|
||||
static const int childrenChangedCommandType = QMetaType::type("ChildrenChangedCommand");
|
||||
static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand");
|
||||
static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand");
|
||||
static const int tokenCommandType = QMetaType::type("TokenCommand");
|
||||
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
|
||||
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
|
||||
static const int puppetToCreatorCommandType = QMetaType::type("PuppetToCreatorCommand");
|
||||
static const int SyncNanotraceCommandType = QMetaType::type("SyncNanotraceCommand");
|
||||
static const int informationChangedCommandType = QMetaType::fromName("InformationChangedCommand").id();
|
||||
static const int valuesChangedCommandType = QMetaType::fromName("ValuesChangedCommand").id();
|
||||
static const int valuesModifiedCommandType = QMetaType::fromName("ValuesModifiedCommand").id();
|
||||
static const int pixmapChangedCommandType = QMetaType::fromName("PixmapChangedCommand").id();
|
||||
static const int childrenChangedCommandType = QMetaType::fromName("ChildrenChangedCommand").id();
|
||||
static const int statePreviewImageChangedCommandType = QMetaType::fromName("StatePreviewImageChangedCommand").id();
|
||||
static const int componentCompletedCommandType = QMetaType::fromName("ComponentCompletedCommand").id();
|
||||
static const int tokenCommandType = QMetaType::fromName("TokenCommand").id();
|
||||
static const int debugOutputCommandType = QMetaType::fromName("DebugOutputCommand").id();
|
||||
static const int changeSelectionCommandType = QMetaType::fromName("ChangeSelectionCommand").id();
|
||||
static const int puppetToCreatorCommandType = QMetaType::fromName("PuppetToCreatorCommand").id();
|
||||
static const int SyncNanotraceCommandType = QMetaType::fromName("SyncNanotraceCommand").id();
|
||||
|
||||
qCInfo(instanceViewBenchmark) << "dispatching command" << command.typeId() << command.typeName();
|
||||
if (command.typeId() == informationChangedCommandType) {
|
||||
@@ -173,7 +173,7 @@ QString NodeInstanceServerProxy::qrcMappingString() const
|
||||
void NodeInstanceServerProxy::writeCommand(const QVariant &command)
|
||||
{
|
||||
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
|
||||
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) {
|
||||
if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
|
||||
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
|
||||
NANOTRACE_INSTANT_ARGS("Sync", "writeCommand",
|
||||
{"name", cmd.name().toStdString()},
|
||||
|
@@ -201,7 +201,7 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &)
|
||||
|
||||
QVariant read(const QString &typeStr, const QString &str)
|
||||
{
|
||||
int type = QMetaType::fromName(typeStr.toUtf8().constData()).id();
|
||||
int type = QMetaType::fromName(typeStr.toUtf8()).id();
|
||||
if (type == 0) {
|
||||
if (typeStr != "binding"_L1 && typeStr != "enum"_L1) {
|
||||
qWarning() << "Type " << typeStr
|
||||
@@ -266,7 +266,7 @@ QVariant read(int variantType, const QString &str)
|
||||
value = vector3DFromString(str, &conversionOk);
|
||||
break;
|
||||
default: {
|
||||
if (variantType == QMetaType::type("Enumeration")) {
|
||||
if (variantType == QMetaType::fromName("Enumeration").id()) {
|
||||
value = QVariant::fromValue<Enumeration>(enumerationFromString(str, &conversionOk));
|
||||
} else {
|
||||
value = QVariant(str);
|
||||
|
@@ -242,23 +242,23 @@ bool isLiteralValue(AST::UiScriptBinding *script)
|
||||
int propertyType(const QString &typeName)
|
||||
{
|
||||
if (typeName == u"bool")
|
||||
return QMetaType::type("bool");
|
||||
return QMetaType::fromName("bool").id();
|
||||
else if (typeName == u"color")
|
||||
return QMetaType::type("QColor");
|
||||
return QMetaType::fromName("QColor").id();
|
||||
else if (typeName == u"date")
|
||||
return QMetaType::type("QDate");
|
||||
return QMetaType::fromName("QDate").id();
|
||||
else if (typeName == u"int")
|
||||
return QMetaType::type("int");
|
||||
return QMetaType::fromName("int").id();
|
||||
else if (typeName == u"real")
|
||||
return QMetaType::type("double");
|
||||
return QMetaType::fromName("double").id();
|
||||
else if (typeName == u"double")
|
||||
return QMetaType::type("double");
|
||||
return QMetaType::fromName("double").id();
|
||||
else if (typeName == u"string")
|
||||
return QMetaType::type("QString");
|
||||
return QMetaType::fromName("QString").id();
|
||||
else if (typeName == u"url")
|
||||
return QMetaType::type("QUrl");
|
||||
return QMetaType::fromName("QUrl").id();
|
||||
else if (typeName == u"var" || typeName == u"variant")
|
||||
return QMetaType::type("QVariant");
|
||||
return QMetaType::fromName("QVariant").id();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ QVariant convertDynamicPropertyValueToVariant(const QString &astValue,
|
||||
return QString();
|
||||
|
||||
const int type = propertyType(astType);
|
||||
if (type == QMetaType::type("QVariant")) {
|
||||
if (type == QMetaType::fromName("QVariant").id()) {
|
||||
if (cleanedValue.isNull()) // Explicitly isNull, NOT isEmpty!
|
||||
return QVariant(static_cast<QVariant::Type>(type));
|
||||
else
|
||||
|
@@ -391,8 +391,8 @@ void NodeInstanceClientProxy::readDataStream()
|
||||
|
||||
QVariant command = readCommandFromIOStream(m_inputIoDevice, &readCommandCounter, &blockSize);
|
||||
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
|
||||
if (command.typeId() != QMetaType::type("EndNanotraceCommand")) {
|
||||
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) {
|
||||
if (command.typeId() != QMetaType::fromName("EndNanotraceCommand").id()) {
|
||||
if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
|
||||
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
|
||||
NANOTRACE_INSTANT_ARGS("Sync", "readCommand",
|
||||
{"name", cmd.name().toStdString()},
|
||||
|
@@ -38,7 +38,7 @@ void TestConnectionManager::writeCommand(const QVariant &command)
|
||||
|
||||
void TestConnectionManager::dispatchCommand(const QVariant &command, Connection &connection)
|
||||
{
|
||||
static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand");
|
||||
static const int synchronizeCommandType = QMetaType::fromName("SynchronizeCommand").id();
|
||||
|
||||
if (command.typeId() == synchronizeCommandType) {
|
||||
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
|
||||
|
Reference in New Issue
Block a user