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 <QtGlobal>
#include <QThread> #include <QThread>
#include <QTimer>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QUrl> #include <QUrl>
#include <QMetaObject>
#include "taskmanager.h" #include "taskmanager.h"
#include "song.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 <QAbstractItemModel>
#include <QItemSelectionModel> #include <QItemSelectionModel>
#include <QList> #include <QList>
#include <QTimer> #include <QMetaObject>
#include <QSettings> #include <QSettings>
#include <QKeySequence> #include <QKeySequence>
#include <QLabel> #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::currentChanged, this, &QueueView::UpdateButtonState);
QObject::connect(ui_->list->selectionModel(), &QItemSelectionModel::selectionChanged, 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 "config.h"
#include <QWidget> #include <QWidget>
#include <QTimer>
#include <QIODevice> #include <QIODevice>
#include <QFile> #include <QFile>
#include <QMessageBox> #include <QMessageBox>
@ -30,6 +29,7 @@
#include <QPainter> #include <QPainter>
#include <QPalette> #include <QPalette>
#include <QDateTime> #include <QDateTime>
#include <QMetaObject>
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include <QKeyEvent> #include <QKeyEvent>
#include <QEnterEvent> #include <QEnterEvent>
@ -292,7 +292,7 @@ void SmartPlaylistSearchTermWidget::resizeEvent(QResizeEvent *e) {
QWidget::resizeEvent(e); QWidget::resizeEvent(e);
if (overlay_ && overlay_->isVisible()) { 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); QWidget::showEvent(e);
if (overlay_) { if (overlay_) {
QTimer::singleShot(0, this, &SmartPlaylistSearchTermWidget::Grab); QMetaObject::invokeMethod(this, &SmartPlaylistSearchTermWidget::Grab);
} }
} }

View File

@ -24,9 +24,9 @@
#include <QWidget> #include <QWidget>
#include <QLocale> #include <QLocale>
#include <QTimer>
#include <QDate> #include <QDate>
#include <QString> #include <QString>
#include <QMetaObject>
#include <QLineEdit> #include <QLineEdit>
#include <QEvent> #include <QEvent>
#include <QKeyEvent> #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). // 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 // 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. // 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);
} }
} }