forked from qt-creator/qt-creator
Use dialogParent() instead of mainWindow()
There are very few reasons to use mainWindow() directly. Especially for modal dialogs, using dialogParent() is important, since that guarantees the stacking order in case of other dialogs currently being open. Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -159,7 +159,7 @@ void CtfTraceManager::load(const QString &filename)
|
||||
|
||||
std::ifstream file(filename.toStdString());
|
||||
if (!file.is_open()) {
|
||||
QMessageBox::warning(Core::ICore::mainWindow(),
|
||||
QMessageBox::warning(Core::ICore::dialogParent(),
|
||||
tr("CTF Visualizer"),
|
||||
tr("Cannot read the CTF file."));
|
||||
return;
|
||||
@@ -179,10 +179,13 @@ void CtfTraceManager::finalize()
|
||||
for (qint64 tid: m_threadModels.keys()) {
|
||||
if (m_threadModels[tid]->m_maxStackSize > 512) {
|
||||
if (!userConsentToIgnoreDeepTraces) {
|
||||
QMessageBox::StandardButton answer = QMessageBox::question(Core::ICore::mainWindow(),
|
||||
tr("CTF Visualizer"),
|
||||
tr("The trace contains threads with stack depth > 512.\nDo you want to display them anyway?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
QMessageBox::StandardButton answer
|
||||
= QMessageBox::question(Core::ICore::dialogParent(),
|
||||
tr("CTF Visualizer"),
|
||||
tr("The trace contains threads with stack depth > "
|
||||
"512.\nDo you want to display them anyway?"),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
if (answer == QMessageBox::No) {
|
||||
userConsentToIgnoreDeepTraces = true;
|
||||
} else {
|
||||
|
||||
@@ -171,7 +171,7 @@ void CtfVisualizerTool::loadJson()
|
||||
m_isLoading = true;
|
||||
|
||||
QString filename = QFileDialog::getOpenFileName(
|
||||
ICore::mainWindow(), tr("Load Chrome Trace Format File"),
|
||||
ICore::dialogParent(), tr("Load Chrome Trace Format File"),
|
||||
"", tr("JSON File (*.json)"));
|
||||
if (filename.isEmpty()) {
|
||||
m_isLoading = false;
|
||||
@@ -192,7 +192,7 @@ void CtfVisualizerTool::loadJson()
|
||||
connect(thread, &QThread::finished, this, [this, thread, task, futureInterface]() {
|
||||
// in main thread:
|
||||
if (m_traceManager->isEmpty()) {
|
||||
QMessageBox::warning(Core::ICore::mainWindow(),
|
||||
QMessageBox::warning(Core::ICore::dialogParent(),
|
||||
tr("CTF Visualizer"),
|
||||
tr("The file does not contain any trace data."));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user