QSSASyncProcess修复重复connect导致的触发问题。

qt6
zcy 2022-10-28 15:12:59 +08:00
parent 43cd74b18f
commit c1890fb547
2 changed files with 7 additions and 3 deletions

View File

@ -1946,6 +1946,7 @@ void QssMaskWidget::paintEvent(QPaintEvent *event)
}
QSSASyncProcess::QSSASyncProcess(QWidget *parent)
:mFirst(true)
{
this->mParent = parent;
}
@ -1959,9 +1960,11 @@ QSSASyncProcess::~QSSASyncProcess()
int QSSASyncProcess::Start(void *p)
{
this->moveToThread(&mThread);
connect(this, SIGNAL(StartRun(void *)), this, SLOT(Run(void *)));
connect(&mThread, &QThread::finished, this, &QObject::deleteLater);
if(mFirst){
connect(this, SIGNAL(StartRun(void *)), this, SLOT(Run(void *)));
connect(&mThread, &QThread::finished, this, &QObject::deleteLater);
mFirst = false;
}
mThread.start();
#ifdef QT_NO_EMIT
StartRun(p);

1
Qss.h
View File

@ -426,6 +426,7 @@ public slots:
protected:
QWidget *mParent;
QThread mThread;
bool mFirst;
};
#define tipBox(text) QssMessageBox::tips(text)