Qt进度条提示对话框


    QProgressDialog dialog(tr("文件复制操作"),tr("取消"),0,50000,this);
    dialog.setWindowTitle(tr("进度条对话框"));
    dialog.setWindowModality(Qt::WindowModal);
    dialog.show();
    for(int i=0;i<=50000;i++)
    {
        dialog.setValue(i);
        QCoreApplication::processEvents();//防止界面冻结
        if(dialog.wasCanceled()) break; //取消就中断
    }
    QMessageBox::information(this,tr("系统提示"),tr("复制完毕"),QMessageBox::Ok);


你可能感兴趣的:(Qt)