Replace 0 msec singleshot with invoke method

This commit is contained in:
Jonas Kvinge 2023-05-03 19:55:58 +02:00
parent 1208ca3ad4
commit 301e6b194a
4 changed files with 9 additions and 9 deletions

View File

@ -23,10 +23,10 @@
#include <QtGlobal>
#include <QThread>
#include <QTimer>
#include <QString>
#include <QStringList>
#include <QUrl>
#include <QMetaObject>
#include "taskmanager.h"
#include "song.h"
@ -123,6 +123,6 @@ void DeleteFiles::ProcessSomeFiles() {
}
}
QTimer::singleShot(0, this, &DeleteFiles::ProcessSomeFiles);
QMetaObject::invokeMethod(this, &DeleteFiles::ProcessSomeFiles);
}

View File

@ -27,7 +27,7 @@
#include <QAbstractItemModel>
#include <QItemSelectionModel>
#include <QList>
#include <QTimer>
#include <QMetaObject>
#include <QSettings>
#include <QKeySequence>
#include <QLabel>
@ -120,7 +120,7 @@ void QueueView::CurrentPlaylistChanged(Playlist *playlist) {
QObject::connect(ui_->list->selectionModel(), &QItemSelectionModel::currentChanged, this, &QueueView::UpdateButtonState);
QObject::connect(ui_->list->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QueueView::UpdateButtonState);
QTimer::singleShot(0, current_playlist_->queue(), &Queue::UpdateSummaryText);
QMetaObject::invokeMethod(current_playlist_->queue(), &Queue::UpdateSummaryText);
}

View File

@ -21,7 +21,6 @@
#include "config.h"
#include <QWidget>
#include <QTimer>
#include <QIODevice>
#include <QFile>
#include <QMessageBox>
@ -30,6 +29,7 @@
#include <QPainter>
#include <QPalette>
#include <QDateTime>
#include <QMetaObject>
#include <QPropertyAnimation>
#include <QKeyEvent>
#include <QEnterEvent>
@ -292,7 +292,7 @@ void SmartPlaylistSearchTermWidget::resizeEvent(QResizeEvent *e) {
QWidget::resizeEvent(e);
if (overlay_ && overlay_->isVisible()) {
QTimer::singleShot(0, this, &SmartPlaylistSearchTermWidget::Grab);
QMetaObject::invokeMethod(this, &SmartPlaylistSearchTermWidget::Grab);
}
}
@ -301,7 +301,7 @@ void SmartPlaylistSearchTermWidget::showEvent(QShowEvent *e) {
QWidget::showEvent(e);
if (overlay_) {
QTimer::singleShot(0, this, &SmartPlaylistSearchTermWidget::Grab);
QMetaObject::invokeMethod(this, &SmartPlaylistSearchTermWidget::Grab);
}
}

View File

@ -24,9 +24,9 @@
#include <QWidget>
#include <QLocale>
#include <QTimer>
#include <QDate>
#include <QString>
#include <QMetaObject>
#include <QLineEdit>
#include <QEvent>
#include <QKeyEvent>
@ -91,7 +91,7 @@ void LoginStateWidget::SetLoggedIn(const State state, const QString &account_nam
// A login just failed - give focus back to the last crediental field (usually password).
// We have to do this after control gets back to the
// event loop because the user might have just closed a dialog and our widget might not be active yet.
QTimer::singleShot(0, this, &LoginStateWidget::FocusLastCredentialField);
QMetaObject::invokeMethod(this, &LoginStateWidget::FocusLastCredentialField);
}
}