1

MainWindow のボタンをクリックすると QProgressBar で新しいウィンドウを作成していますが、新しいウィンドウを作成しているときに、充填サイクルが機能している間は QProgressBar が表示されません。その後、QProgressBar が表示され、塗りつぶされます。

コンストラクタ:

ProgressWin::ProgressWin():QWidget()
{
    this->resize(273,98);
    this->move(670, 430);
    bar1 = new QProgressBar(this);
    bar1->setGeometry(20, 31, 251, 31);
    bar1->setMinimum(0);
    bar1->setMaximum(10000);
    this->show();
    unsigned long long secr, PQ;
    unsigned long long rv;
    unsigned long long decr;
    for(int v = 0; v <= 100000; v++) {
            bar1->setValue(v);
    }
}

新しいウィンドウを呼び出すボタンのコード:

void RsaMainWindow::ButtClickCrypt()
{
    FileName1 = ui->LineCrypt->text();
    if(FileName1.isEmpty()) {
        QMessageBox::information(0, "Information", "File for Crypt wasn't chosen");
        return;
    }
    NewWin = new ProgressWin;
}

新しいウィンドウのクラス:

class ProgressWin : public QWidget
{
    QProgressBar *bar1;
public:
    ProgressWin();
};

MainWindow のクラス:

[namespace Ui {
class RsaMainWindow;
}

class RsaMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit RsaMainWindow(QWidget *parent = 0);
    ~RsaMainWindow();

private slots:
    void ButtClickViewCryp();
    void ButtClickViewDecr();
    void ButtClickViewKeys();
    void ButtClickCrypt();
    void ButtClickDecr();

private:
    Ui::RsaMainWindow *ui;
    QString FileName1;
    QString FileName2;
    QString FileName3;
    ProgressWin *NewWin;

};][1]
4

1 に答える 1