Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.5.6, 6.7.2, 6.8.0 Beta2
-
Windows 10 22H2 + MSVC 2022; Ubuntu 22.04 Wayland + GCC 11.4.0 (both XCB and Wayland plugins)
Description
QFileDialog respects the "ApplicationModal" flag, but FileDialog does not.
Code
Widgets version:
#include <QApplication> #include <QPushButton> #include <QFileDialog> int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton mainButton("Open QFileDialog"); mainButton.setWindowTitle("Main Window"); mainButton.resize(400, 300); mainButton.show(); QPushButton otherButton("Other"); otherButton.setWindowTitle("Other Window"); otherButton.resize(400, 300); otherButton.show(); QObject::connect(&mainButton, &QPushButton::clicked, &app, [&]{ qDebug("Clicked main button"); QFileDialog dlg(&mainButton); dlg.setWindowModality(Qt::ApplicationModal); dlg.exec(); }); QObject::connect(&otherButton, &QPushButton::clicked, &app, []{ qDebug("Clicked other button"); }); return app.exec(); }
QML version:
import QtQuick.Controls.Basic import QtQuick.Dialogs ApplicationWindow { width: 400 height: 400 visible: true title: "Main Window" ApplicationWindow { width: 400 height: 400 visible: true title: "Other Window" Button { text: "Other" onClicked: console.log("Clicked other button") } } Button { text: "Open FileDialog" onClicked: { console.log("Clicked main button") fileDlg.open() } } FileDialog { id: fileDlg modality: Qt.ApplicationModal } }
Steps to reproduce
- Click the main button to open the file dialog
- While the file dialog is open, attempt to click on the 2 windows' buttons (check the console output for results)
Expected outcomes (Widgets)
(Windows and Ubuntu) While the file dialog is open, both of the windows' buttons cannot be clicked
Actual outcomes (QtQuick.Dialogs)
While the file dialog is open...
- (Windows) ...the Main button cannot be clicked, but the Other button can be clicked
- (Ubuntu) ...both the Main button and the Other button can be clicked
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-127605 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
584647,15 | Propagate modality to the non-native quick dialogs | dev | qt/qtdeclarative | Status: NEW | 0 | 0 |