aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/progressdialog.cpp
blob: cb73ebda10cf6d225deff53f87f1c2abb9f37a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "progressdialog.h"

#include "guiutils.h"
#include "utilstr.h"

namespace Utils {

QProgressDialog *createProgressDialog(int maxValue, const QString &windowTitle,
                                      const QString &labelText)
{
    QProgressDialog *progressDialog = new QProgressDialog(labelText, Tr::tr("Cancel"),
                                                          0, maxValue, dialogParent());
    progressDialog->setWindowModality(Qt::ApplicationModal);
    progressDialog->setMinimumDuration(INT_MAX); // see QTBUG-135797
    progressDialog->setWindowTitle(windowTitle);
    progressDialog->setFixedSize(progressDialog->sizeHint());
    progressDialog->setAutoClose(false);
    progressDialog->show();
    return progressDialog;
}

} // namespace Utils