void widget_view::show(class_filter *f) { // set loading status loading = true; // create loader thread QThread* thread = new QThread; class_loader* loader = new class_loader(config, filename); loader->moveToThread(thread); connect(thread, SIGNAL(started()), loader, SLOT(process())); connect(loader, SIGNAL(finished()), thread, SLOT(quit())); connect(loader, SIGNAL(finished()), loader, SLOT(deleteLater())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); // connect loader signals connect(loader, SIGNAL(data(QString)), this, SLOT(slot_add_data(QString))); connect(loader, SIGNAL(finished()), this, SLOT(slot_finished())); connect(loader, SIGNAL(progress(int)), this, SLOT(slot_progress(int))); // trigger loader when template loading is finished connect(this, SIGNAL(loadFinished(bool)), thread, SLOT(start())); // set highligting highlight(hide); // initialize view setUrl(QUrl("qrc:/view/view.html")); }
LogSelectorForm::LogSelectorForm(QWidget *parent) : QWidget(parent), ui(new Ui::LogSelectorForm){ ui->setupUi(this); QDir config; config.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)); connect(&this->FutureWatcher, SIGNAL (finished()), this, SLOT (slot_finished())); }
BackgroundRunner::BackgroundRunner(QObject *const receiver, bool isUseGUI) : m_receiver(receiver), m_workerThread(new QThread), m_slotCount(0), m_finishedSlotCount(0) { //根据参数isUseGUI的值来决定槽运行在哪个线程中 //若receiver使用主线程,m_workerThread将仅用于关联槽和启动槽 QThread *const targetThread = isUseGUI ? _getMainThread() : m_workerThread; receiver->moveToThread(targetThread); connect(receiver, SIGNAL(slot_finished()), this, SLOT(slotFinished())); }
windowLoadMiRNAF::windowLoadMiRNAF(QString const& _fileName,QWidget *parent) : QWidget(parent), fileName(_fileName), ui(new Ui::windowLoadMiRNAF), m_oTF(0) { ui->setupUi(this); ui->settingsButton->setIcon(QIcon("./images/gear.png")); //not visible labelFileSelectedMirna ui->labelFileSelectedMirna->setVisible(false); //change the color of label ui->labelAnalyzeResults->setStyleSheet(("* { background-color:gray }")); //not visible button NextAnalyzeResults ui->NextAnalyzeResults->setEnabled(false); qobject_cast<QMainWindow *> (this->parentWidget())->statusBar()->showMessage(tr("II.1.Load miRNA")); m_oTF=new TargetFinder(); this->ui->progressBar->setMinimum(0); this->ui->progressBar->setMaximum(0); this->ui->progressBar->hide(); connect(&this->FutureWatcher, SIGNAL(finished()), this, SLOT(slot_finished())); }