Commit 8d62b127 authored by Alexander Volkov's avatar Alexander Volkov

Use QMetaObject::invokeMethod() overloads for function pointers

... to check slots spelling at compile time.
parent 12206443
......@@ -561,7 +561,7 @@ void BrowseMainPage::slotUrlsDropped(const QUrl &destUrl, QDropEvent* event)
// We can't call FileOperations::showMenuForDroppedUrls() directly because
// we need the slot to return so that the drop event is accepted. Otherwise
// the drop cursor is still visible when the menu is shown.
QMetaObject::invokeMethod(this, "showMenuForDroppedUrls", Qt::QueuedConnection, Q_ARG(QList<QUrl>, urlList), Q_ARG(QUrl, destUrl));
QMetaObject::invokeMethod(this, [this, urlList, destUrl]() { showMenuForDroppedUrls(urlList, destUrl); }, Qt::QueuedConnection);
}
void BrowseMainPage::showMenuForDroppedUrls(const QList<QUrl>& urlList, const QUrl &destUrl)
......
......@@ -224,7 +224,7 @@ FileOpsContextManagerItem::FileOpsContextManagerItem(ContextManager* manager, QL
// Delay action update because it must happen *after* main window has called
// createGUI(), otherwise calling mXMLGUIClient->plugActionList() will
// fail.
QMetaObject::invokeMethod(this, "updateActions", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &FileOpsContextManagerItem::updateActions, Qt::QueuedConnection);
}
FileOpsContextManagerItem::~FileOpsContextManagerItem()
......
......@@ -177,7 +177,7 @@ void FolderViewContextManagerItem::slotRowsInserted(const QModelIndex& parentInd
if (!parentIndex.isValid() || mModel->urlForIndex(parentIndex).isParentOf(mUrlToSelect)) {
mExpandingIndex = parentIndex;
// Hack because otherwise indexes are not in correct order!
QMetaObject::invokeMethod(this, "expandToSelectedUrl", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &FolderViewContextManagerItem::expandToSelectedUrl, Qt::QueuedConnection);
}
}
......
......@@ -320,7 +320,7 @@ void KIPIInterface::loadOnePlugin()
// If we reach this point, we just loaded one plugin. Go back to the
// event loop. We will come back to load the remaining plugins or create
// the menu later
QMetaObject::invokeMethod(this, "loadOnePlugin", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &KIPIInterface::loadOnePlugin, Qt::QueuedConnection);
return;
}
......
......@@ -74,6 +74,6 @@ int main(int argc, char *argv[])
Gwenview::ImportDialog* dialog = new Gwenview::ImportDialog();
dialog->show();
QMetaObject::invokeMethod(dialog, "setSourceUrl", Qt::QueuedConnection, Q_ARG(QUrl, url), Q_ARG(QString, deviceUdi));
QMetaObject::invokeMethod(dialog, [dialog, url, deviceUdi]() { dialog->setSourceUrl(url, deviceUdi); }, Qt::QueuedConnection);
return app.exec();
}
......@@ -331,7 +331,7 @@ void ContextManager::slotRowsInserted()
// thumbnail bar is visible, the image will not be selected in the thumbnail
// bar.
if (d->mUrlToSelect.isValid()) {
QMetaObject::invokeMethod(this, "selectUrlToSelect", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &ContextManager::selectUrlToSelect, Qt::QueuedConnection);
}
}
......
......@@ -69,7 +69,7 @@ void DocumentJob::setDocument(const Document::Ptr& doc)
void DocumentJob::start()
{
QMetaObject::invokeMethod(this, "doStart", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &DocumentJob::doStart, Qt::QueuedConnection);
}
bool DocumentJob::checkDocumentEditor()
......
......@@ -561,7 +561,7 @@ void DocumentView::openUrl(const QUrl &url, const DocumentView::Setup& setup)
connect(d->mDocument.data(), &Document::kindDetermined,
this, &DocumentView::finishOpenUrl);
} else {
QMetaObject::invokeMethod(this, "finishOpenUrl", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &DocumentView::finishOpenUrl, Qt::QueuedConnection);
}
d->setupBirdEyeView();
}
......@@ -1040,7 +1040,7 @@ bool DocumentView::sceneEventFilter(QGraphicsItem*, QEvent* event)
if (mouseEvent->button() == Qt::LeftButton) {
d->mDragStartPosition = mouseEvent->pos();
}
QMetaObject::invokeMethod(this, "emitFocused", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &DocumentView::emitFocused, Qt::QueuedConnection);
} else if (event->type() == QEvent::GraphicsSceneHoverMove) {
if (d->mBirdEyeView) {
d->mBirdEyeView->onMouseMoved();
......
......@@ -277,7 +277,7 @@ void DocumentViewContainer::updateLayout()
for (DocumentView* view : qAsConst(d->mRemovedViews)) {
view->deleteLater();
}
QMetaObject::invokeMethod(this, "pretendFadeInFinished", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &DocumentViewContainer::pretendFadeInFinished, Qt::QueuedConnection);
}
d->mRemovedViews.clear();
}
......
......@@ -273,7 +273,7 @@ void RasterImageView::loadFromDocument()
void RasterImageView::slotDocumentMetaInfoLoaded()
{
if (document()->size().isValid()) {
QMetaObject::invokeMethod(this, "finishSetDocument", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &RasterImageView::finishSetDocument, Qt::QueuedConnection);
} else {
// Could not retrieve image size from meta info, we need to load the
// full image now.
......
......@@ -63,7 +63,7 @@ void SvgImageView::loadFromDocument()
GV_RETURN_IF_FAIL(doc);
if (doc->loadingState() == Document::Loaded) {
QMetaObject::invokeMethod(this, "finishLoadFromDocument", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &SvgImageView::finishLoadFromDocument, Qt::QueuedConnection);
}
// Ensure finishLoadFromDocument is also called when
......
......@@ -243,7 +243,7 @@ void VideoViewAdapter::setDocument(const Document::Ptr &doc)
// If we do not use a queued connection, the signal arrives too early,
// preventing the listing of the dir content when Gwenview is started with
// a video as an argument.
QMetaObject::invokeMethod(this, "completed", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &VideoViewAdapter::completed, Qt::QueuedConnection);
}
Document::Ptr VideoViewAdapter::document() const
......
......@@ -42,7 +42,7 @@ void DBusAbstractAdaptor::signalPropertyChange(const QString &propertyName, cons
if (firstChange) {
// trigger signal emission on next event loop
QMetaObject::invokeMethod(this, "emitPropertiesChangeDBusSignal", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &DBusAbstractAdaptor::emitPropertiesChangeDBusSignal, Qt::QueuedConnection);
}
}
......
......@@ -315,7 +315,7 @@ void ThumbnailProvider::determineNextIcon()
if (UrlUtils::urlIsFastLocalFile(mCurrentUrl)) {
QFileInfo fileInfo(mCurrentUrl.toLocalFile());
mOriginalTime = fileInfo.lastModified().toSecsSinceEpoch();
QMetaObject::invokeMethod(this, "checkThumbnail", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &ThumbnailProvider::checkThumbnail, Qt::QueuedConnection);
} else {
KIO::Job* job = KIO::stat(mCurrentUrl, KIO::HideProgressInfo);
KJobWidgets::setWindow(job, qApp->activeWindow());
......
......@@ -797,7 +797,7 @@ void DocumentTest::testUndoStackPush()
protected:
void redo() override
{
QMetaObject::invokeMethod(this, "finish", Qt::QueuedConnection, Q_ARG(bool, true));
QMetaObject::invokeMethod(this, [this]() { finish(true); }, Qt::QueuedConnection);
}
};
......@@ -806,7 +806,7 @@ void DocumentTest::testUndoStackPush()
protected:
void redo() override
{
QMetaObject::invokeMethod(this, "finish", Qt::QueuedConnection, Q_ARG(bool, false));
QMetaObject::invokeMethod(this, [this]() { finish(false); }, Qt::QueuedConnection);
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment