full repaired

This commit is contained in:
Skycoder42
2016-02-08 13:45:41 +01:00
parent 8eb1ad543a
commit 76f573ec26
+12 -7
View File
@@ -7,8 +7,8 @@ HotTestWidget::HotTestWidget(QWidget *parent) :
hotkey_1(new QHotkey(this)), hotkey_1(new QHotkey(this)),
hotkey_2(new QHotkey(this)), hotkey_2(new QHotkey(this)),
hotkey_3(new QHotkey(this)), hotkey_3(new QHotkey(this)),
hotkey_4(new QHotkey(NULL)), hotkey_4(new QHotkey(this)),
hotkey_5(new QHotkey(NULL)), hotkey_5(new QHotkey(this)),
thread4(new QThread(this)), thread4(new QThread(this)),
thread5(new QThread(this)), thread5(new QThread(this)),
testHotkeys() testHotkeys()
@@ -100,9 +100,6 @@ HotTestWidget::~HotTestWidget()
this->thread5->quit(); this->thread5->quit();
this->thread5->wait(); this->thread5->wait();
delete this->hotkey_4;
delete this->hotkey_5;
delete ui; delete ui;
} }
@@ -201,7 +198,9 @@ void HotTestWidget::on_threadEnableCheckBox_clicked()
Q_ASSERT(!this->hotkey_4->isRegistered()); Q_ASSERT(!this->hotkey_4->isRegistered());
Q_ASSERT(!this->hotkey_5->isRegistered()); Q_ASSERT(!this->hotkey_5->isRegistered());
this->hotkey_4->setParent(NULL);
this->hotkey_4->moveToThread(this->thread4); this->hotkey_4->moveToThread(this->thread4);
this->hotkey_5->setParent(NULL);
this->hotkey_5->moveToThread(this->thread5); this->hotkey_5->moveToThread(this->thread5);
QApplication::processEvents(); QApplication::processEvents();
@@ -210,10 +209,16 @@ void HotTestWidget::on_threadEnableCheckBox_clicked()
connect(this->thread4, &QThread::finished, this, [this](){ connect(this->thread4, &QThread::finished, this, [this](){
this->hotkey_4->moveToThread(qApp->thread()); this->hotkey_4->moveToThread(qApp->thread());
}); connect(this->thread4, &QThread::destroyed, this, [this](){
delete this->hotkey_4;
}, Qt::DirectConnection);
}, Qt::DirectConnection);
connect(this->thread5, &QThread::finished, this, [this](){ connect(this->thread5, &QThread::finished, this, [this](){
this->hotkey_5->moveToThread(qApp->thread()); this->hotkey_5->moveToThread(qApp->thread());
}); connect(this->hotkey_5, &QThread::destroyed, this, [this](){
delete this->hotkey_5;
}, Qt::DirectConnection);
}, Qt::DirectConnection);
this->ui->tabWidget->setCurrentIndex(0); this->ui->tabWidget->setCurrentIndex(0);
} }