mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-21 03:55:04 +00:00
fix:避免子线程更新ui
This commit is contained in:
parent
01898bfbda
commit
9506957da4
1 changed files with 9 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
|||
#include <QTime>
|
||||
#include <QKeyEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QTimer>
|
||||
|
||||
#include "dialog.h"
|
||||
#include "ui_dialog.h"
|
||||
|
@ -147,10 +148,14 @@ void Dialog::on_startAdbdBtn_clicked()
|
|||
|
||||
void Dialog::outLog(const QString &log, bool newLine)
|
||||
{
|
||||
ui->outEdit->append(log);
|
||||
if (newLine) {
|
||||
ui->outEdit->append("<br/>");
|
||||
}
|
||||
// avoid sub thread update ui
|
||||
QString backLog = log;
|
||||
QTimer::singleShot(0, this, [this, backLog, newLine](){
|
||||
ui->outEdit->append(backLog);
|
||||
if (newLine) {
|
||||
ui->outEdit->append("<br/>");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool Dialog::checkAdbRun()
|
||||
|
|
Loading…
Add table
Reference in a new issue