QueueOnObject: accept pointers to member functions
This commit is contained in:
parent
7cb8d6612c
commit
1e27e87d93
|
@ -877,7 +877,7 @@ void MainWindow::OnImportNANDBackup()
|
|||
.arg((QDateTime::currentDateTime().toMSecsSinceEpoch() - beginning) / 1000));
|
||||
});
|
||||
});
|
||||
QueueOnObject(dialog, [dialog] { dialog->close(); });
|
||||
QueueOnObject(dialog, &QProgressDialog::close);
|
||||
});
|
||||
|
||||
dialog->exec();
|
||||
|
|
|
@ -405,7 +405,7 @@ void NetPlayDialog::StopGame()
|
|||
|
||||
void NetPlayDialog::Update()
|
||||
{
|
||||
QueueOnObject(this, [this] { UpdateGUI(); });
|
||||
QueueOnObject(this, &NetPlayDialog::UpdateGUI);
|
||||
}
|
||||
|
||||
void NetPlayDialog::DisplayMessage(const QString& msg, const std::string& color, int duration)
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
// arbitrary code from non-GUI threads. For more information, see:
|
||||
// https://stackoverflow.com/questions/21646467/
|
||||
|
||||
template <typename F>
|
||||
static void QueueOnObject(QObject* obj, F&& func)
|
||||
template <typename T, typename F>
|
||||
static void QueueOnObject(T* obj, F&& func)
|
||||
{
|
||||
QObject src;
|
||||
QObject::connect(&src, &QObject::destroyed, obj, std::forward<F>(func), Qt::QueuedConnection);
|
||||
|
|
Loading…
Reference in New Issue