diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-11-11 16:34:39 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-11-16 13:45:02 +0000 |
commit | 6d5e30215762255abb76faa2d81a1a8ff60b8960 (patch) | |
tree | 3d62b027bf5a94b55b79eaa796b233b50f8a3e17 /src/plugins | |
parent | 3167d23a36ff5b9fd42105f763b9e19bf62596cb (diff) | |
download | qt-creator-6d5e30215762255abb76faa2d81a1a8ff60b8960.tar.gz |
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/plugins')
-rw-r--r-- | src/plugins/clearcase/clearcaseplugin.cpp | 2 | ||||
-rw-r--r-- | src/plugins/coreplugin/find/basetextfind.cpp | 3 | ||||
-rw-r--r-- | src/plugins/coreplugin/locator/opendocumentsfilter.cpp | 3 | ||||
-rw-r--r-- | src/plugins/cpptools/stringtable.cpp | 3 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdbengine.cpp | 3 | ||||
-rw-r--r-- | src/plugins/debugger/uvsc/uvscengine.cpp | 4 | ||||
-rw-r--r-- | src/plugins/help/helpindexfilter.cpp | 4 | ||||
-rw-r--r-- | src/plugins/help/searchwidget.cpp | 2 | ||||
-rw-r--r-- | src/plugins/projectexplorer/foldernavigationwidget.cpp | 6 | ||||
-rw-r--r-- | src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp | 6 |
10 files changed, 20 insertions, 16 deletions
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index 770cbf2def..d8765f8bca 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -1059,7 +1059,7 @@ void ClearCasePluginPrivate::setStatus(const QString &file, FileStatus::Status s m_statusMap->insert(file, FileStatus(status, QFileInfo(file).permissions())); if (update && currentState().currentFile() == file) - QMetaObject::invokeMethod(this, "updateStatusActions"); + QMetaObject::invokeMethod(this, &ClearCasePluginPrivate::updateStatusActions); } void ClearCasePluginPrivate::undoCheckOutCurrent() diff --git a/src/plugins/coreplugin/find/basetextfind.cpp b/src/plugins/coreplugin/find/basetextfind.cpp index c58447e8b7..dec5d4186e 100644 --- a/src/plugins/coreplugin/find/basetextfind.cpp +++ b/src/plugins/coreplugin/find/basetextfind.cpp @@ -451,6 +451,9 @@ QTextCursor BaseTextFind::findOne(const QRegularExpression &expr, if (!inScope(candidate.selectionStart(), candidate.selectionEnd())) return candidate; bool inVerticalFindScope = false; + // This code relies on the fact, that we have to keep TextEditorWidget subclass + // inside d->m_plaineditor which is of QPlainTextEdit class. So we can't + // transform it into a typed version now, as it relies on a dynamic match. QMetaObject::invokeMethod(d->m_plaineditor, "inFindScope", Qt::DirectConnection, Q_RETURN_ARG(bool, inVerticalFindScope), Q_ARG(QTextCursor, candidate)); diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp index fe67e5d884..b58293fae8 100644 --- a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp @@ -113,7 +113,8 @@ QList<OpenDocumentsFilter::Entry> OpenDocumentsFilter::editors() const void OpenDocumentsFilter::refresh(QFutureInterface<void> &future) { Q_UNUSED(future) - QMetaObject::invokeMethod(this, "refreshInternally", Qt::BlockingQueuedConnection); + QMetaObject::invokeMethod(this, &OpenDocumentsFilter::refreshInternally, + Qt::BlockingQueuedConnection); } void OpenDocumentsFilter::accept(LocatorFilterEntry selection, diff --git a/src/plugins/cpptools/stringtable.cpp b/src/plugins/cpptools/stringtable.cpp index e27fc5ceae..efd186fada 100644 --- a/src/plugins/cpptools/stringtable.cpp +++ b/src/plugins/cpptools/stringtable.cpp @@ -108,7 +108,8 @@ QString StringTablePrivate::insert(const QString &string) void StringTable::scheduleGC() { - QMetaObject::invokeMethod(&m_instance->m_gcCountDown, "start", Qt::QueuedConnection); + QMetaObject::invokeMethod(&m_instance->m_gcCountDown, QOverload<>::of(&QTimer::start), + Qt::QueuedConnection); } StringTable::StringTable() diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 3e76d5a782..af373a1de1 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -765,8 +765,7 @@ void GdbEngine::runCommand(const DebuggerCommand &command) m_scheduledTestResponses.remove(token); showMessage(QString("FAKING TEST RESPONSE (TOKEN: %2, RESPONSE: %3)") .arg(token).arg(buffer)); - QMetaObject::invokeMethod(this, "handleResponse", - Q_ARG(QString, buffer)); + QMetaObject::invokeMethod(this, [this, buffer] { handleResponse(buffer); }); } else { m_gdbProc.write(cmd.function.toUtf8() + "\r\n"); if (command.flags & NeedsFlush) diff --git a/src/plugins/debugger/uvsc/uvscengine.cpp b/src/plugins/debugger/uvsc/uvscengine.cpp index 75e8bddb8d..ca2619f4f0 100644 --- a/src/plugins/debugger/uvsc/uvscengine.cpp +++ b/src/plugins/debugger/uvsc/uvscengine.cpp @@ -531,8 +531,8 @@ void UvscEngine::doUpdateLocals(const UpdateParameters ¶ms) const bool partial = !params.partialVariable.isEmpty(); // This is a workaround to avoid a strange QVector index assertion // inside of the watch model. - QMetaObject::invokeMethod(this, "handleUpdateLocals", Qt::QueuedConnection, - Q_ARG(bool, partial)); + QMetaObject::invokeMethod(this, [this, partial] { handleUpdateLocals(partial); }, + Qt::QueuedConnection); } void UvscEngine::updateAll() diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index 45d2ba6388..693d56dbb3 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -180,8 +180,8 @@ QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFi if (forceUpdate) { QStringList indices; - QMetaObject::invokeMethod(this, "allIndices", Qt::BlockingQueuedConnection, - Q_RETURN_ARG(QStringList, indices)); + QMetaObject::invokeMethod(this, [this] { return allIndices(); }, + Qt::BlockingQueuedConnection, &indices); m_mutex.lock(); // guard m_needsUpdate m_needsUpdate = false; m_mutex.unlock(); diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp index 48d4834737..cb2db9f76d 100644 --- a/src/plugins/help/searchwidget.cpp +++ b/src/plugins/help/searchwidget.cpp @@ -155,7 +155,7 @@ void SearchWidget::showEvent(QShowEvent *event) connect(searchEngine, &QHelpSearchEngine::indexingFinished, this, &SearchWidget::indexingFinished); - QMetaObject::invokeMethod(&LocalHelpManager::helpEngine(), "setupFinished", + QMetaObject::invokeMethod(&LocalHelpManager::helpEngine(), &QHelpEngine::setupFinished, Qt::QueuedConnection); } } diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 9ebf310681..f54ea3f7d9 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -388,10 +388,8 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent // QTimer::singleShot only posts directly onto the event loop if you use the SLOT("...") // notation, so using a singleShot with a lambda would flicker // QTimer::singleShot(0, this, [this, filePath]() { setCrumblePath(filePath); }); - QMetaObject::invokeMethod(this, - "setCrumblePath", - Qt::QueuedConnection, - Q_ARG(Utils::FilePath, filePath)); + QMetaObject::invokeMethod(this, [this, filePath] { setCrumblePath(filePath); }, + Qt::QueuedConnection); }); connect(m_crumbLabel, &Utils::FileCrumbLabel::pathClicked, [this](const Utils::FilePath &path) { const QModelIndex rootIndex = m_sortProxyModel->mapToSource(m_listView->rootIndex()); diff --git a/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp b/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp index 604824d464..6e941fd807 100644 --- a/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp +++ b/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp @@ -832,7 +832,8 @@ void GraphicsScene::addWarningItem(WarningItem *item) if (!m_allWarnings.contains(item)) { m_allWarnings << item; if (!m_autoLayoutRunning && !m_initializing) - QMetaObject::invokeMethod(this, "warningVisibilityChanged", Qt::QueuedConnection, Q_ARG(int, 0)); + QMetaObject::invokeMethod(this, [this] { warningVisibilityChanged(0); }, + Qt::QueuedConnection); } } @@ -841,7 +842,8 @@ void GraphicsScene::removeWarningItem(WarningItem *item) m_allWarnings.removeAll(item); if (!m_autoLayoutRunning && !m_initializing) - QMetaObject::invokeMethod(this, "warningVisibilityChanged", Qt::QueuedConnection, Q_ARG(int, 0)); + QMetaObject::invokeMethod(this, [this] { warningVisibilityChanged(0); }, + Qt::QueuedConnection); } void GraphicsScene::warningVisibilityChanged(int type, WarningItem *item) |