我想QProgressBar
在以下函数中使用 a:
void InstallingWindow::install_package(QString pkgname, QString tempdir){
qDebug() << "Imported tempdir is " + tempdir;
QFile ee_script("/usr/bin/ee_script");
QString program_install = "sudo /usr/bin/ee_script " + pkgname + " " + tempdir + " install";
if (!ee_script.exists()){
qDebug() << "Install script does not exists";
ee_script.error();
}
else{
process_install->start(program_install);
ui->progressBar->setMinimum(0);
ui->progressBar->setMaximum(0);
connect(process_install, SIGNAL(finished(int, QProcess::ExitStatus)), ui->progressBar, SLOT(show_progress_bar()));
process_install->waitForFinished(-1); //this will make the screen blank
ui->progressBar->setMaximum(0);
ui->progressBar->setValue(100);
ui->nextButton->setEnabled(true);
}
post_install();
}
void InstallingWindow::show_progress_bar(){
ui->progressBar->setMaximum(100);
ui->progressBar->setValue(100);
ui->nextButton->setEnabled(true);
}
我希望进度条用作等待条(最初;稍后将使用计时器实现)并在完成后完成(在 100 处完成)QProcess
。我得到一个空白的黑屏process_install->waitForFinished(-1)
。我尝试了很多选择,但都是徒劳的,虽然QProgressDialog
效果很好。请帮助我哪里出了错,我该怎么办。