aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-11-11 16:34:39 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-11-16 13:45:02 +0000
commit6d5e30215762255abb76faa2d81a1a8ff60b8960 (patch)
tree3d62b027bf5a94b55b79eaa796b233b50f8a3e17 /src/libs
parent3167d23a36ff5b9fd42105f763b9e19bf62596cb (diff)
Use typed syntax in calls to QMetaObject::invokeMethod
We do it wherever possible. Some places can't be fixed since they still rely on dynamic introspection (mainly QQuickItem cases). Change-Id: Ia00b4a04d8b995c9a43b7bf2dbe76a60364bb8ca Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/advanceddockingsystem/dockareatitlebar.cpp8
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp5
-rw-r--r--src/libs/qmljs/qmljsplugindumper.cpp12
-rw-r--r--src/libs/ssh/sshconnectionmanager.cpp10
4 files changed, 16 insertions, 19 deletions
diff --git a/src/libs/advanceddockingsystem/dockareatitlebar.cpp b/src/libs/advanceddockingsystem/dockareatitlebar.cpp
index 4430f936723..f2a2ad4cc0c 100644
--- a/src/libs/advanceddockingsystem/dockareatitlebar.cpp
+++ b/src/libs/advanceddockingsystem/dockareatitlebar.cpp
@@ -293,7 +293,8 @@ namespace ADS
if (QEvent::EnabledChange == event->type() && m_hideWhenDisabled) {
// force setVisible() call
// Calling setVisible() directly here doesn't work well when button is expected to be shown first time
- QMetaObject::invokeMethod(this, "setVisible", Qt::QueuedConnection, Q_ARG(bool, isEnabled()));
+ const bool visible = isEnabled();
+ QMetaObject::invokeMethod(this, [this, visible] { setVisible(visible); }, Qt::QueuedConnection);
}
return Super::event(event);
@@ -352,8 +353,9 @@ namespace ADS
break;
}
}
- bool visible = (hasElidedTabTitle && (d->m_tabBar->count() > 1));
- QMetaObject::invokeMethod(d->m_tabsMenuButton, "setVisible", Qt::QueuedConnection, Q_ARG(bool, visible));
+ const bool visible = (hasElidedTabTitle && (d->m_tabBar->count() > 1));
+ QMetaObject::invokeMethod(this, [this, visible] {
+ d->m_tabsMenuButton->setVisible(visible); }, Qt::QueuedConnection);
}
d->m_menuOutdated = true;
}
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index 3cc8db7e630..210adf6096b 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -1250,8 +1250,7 @@ void ModelManagerInterface::maybeQueueCppQmlTypeUpdate(const CPlusPlus::Document
doc->releaseSourceAndAST();
// delegate actual queuing to the gui thread
- QMetaObject::invokeMethod(this, "queueCppQmlTypeUpdate",
- Q_ARG(CPlusPlus::Document::Ptr, doc), Q_ARG(bool, scan));
+ QMetaObject::invokeMethod(this, [=] { queueCppQmlTypeUpdate(doc, scan); });
}
void ModelManagerInterface::queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan)
@@ -1392,7 +1391,7 @@ void ModelManagerInterface::updateCppQmlTypes(
qmlModelManager->m_cppDeclarationFiles = newDeclarations;
if (hasNewInfo)
// one could get away with re-linking the cpp types...
- QMetaObject::invokeMethod(qmlModelManager, "asyncReset");
+ QMetaObject::invokeMethod(qmlModelManager, &ModelManagerInterface::asyncReset);
}
ModelManagerInterface::CppDataHash ModelManagerInterface::cppData() const
diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp
index 8b7604809b6..a1c084a59a9 100644
--- a/src/libs/qmljs/qmljsplugindumper.cpp
+++ b/src/libs/qmljs/qmljsplugindumper.cpp
@@ -65,24 +65,20 @@ Utils::FileSystemWatcher *PluginDumper::pluginWatcher()
void PluginDumper::loadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info)
{
// move to the owning thread
- metaObject()->invokeMethod(this, "onLoadBuiltinTypes",
- Q_ARG(QmlJS::ModelManagerInterface::ProjectInfo, info));
+ metaObject()->invokeMethod(this, [=] { onLoadBuiltinTypes(info); });
}
void PluginDumper::loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion)
{
// move to the owning thread
- metaObject()->invokeMethod(this, "onLoadPluginTypes",
- Q_ARG(QString, libraryPath),
- Q_ARG(QString, importPath),
- Q_ARG(QString, importUri),
- Q_ARG(QString, importVersion));
+ metaObject()->invokeMethod(this, [=] { onLoadPluginTypes(libraryPath, importPath,
+ importUri, importVersion); });
}
void PluginDumper::scheduleRedumpPlugins()
{
// move to the owning thread
- metaObject()->invokeMethod(this, "dumpAllPlugins", Qt::QueuedConnection);
+ metaObject()->invokeMethod(this, &PluginDumper::dumpAllPlugins, Qt::QueuedConnection);
}
void PluginDumper::onLoadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info, bool force)
diff --git a/src/libs/ssh/sshconnectionmanager.cpp b/src/libs/ssh/sshconnectionmanager.cpp
index 68533728f23..ac73878b8cc 100644
--- a/src/libs/ssh/sshconnectionmanager.cpp
+++ b/src/libs/ssh/sshconnectionmanager.cpp
@@ -107,11 +107,11 @@ public:
|| connection->connectionParameters() != sshParams)
continue;
- if (connection->thread() != QThread::currentThread()) {
- QMetaObject::invokeMethod(this, "switchToCallerThread",
- Qt::BlockingQueuedConnection,
- Q_ARG(SshConnection *, connection),
- Q_ARG(QObject *, QThread::currentThread()));
+ auto currentThread = QThread::currentThread();
+ if (connection->thread() != currentThread) {
+ QMetaObject::invokeMethod(this, [this, connection, currentThread] {
+ switchToCallerThread(connection, currentThread);
+ }, Qt::BlockingQueuedConnection);
}
m_unacquiredConnections.removeOne(c);