Summary: | Spawning a KDE file picker dialog via Qt Quick Dialogs fails | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-kio | Reporter: | Eike Hein <hein> |
Component: | general | Assignee: | Maarten De Meyer <de.meyer.maarten> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | cjacker, de.meyer.maarten, hughgao01, jens.goller, jpwhiting, kde, kde, kdelibs-bugs, luigide, s, simonandric5 |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/frameworkintegration/9814e4b773b2b34afafa0c5d242594bbb4f9a6ae | Version Fixed In: | |
Sentry Crash Report: |
Description
Eike Hein
2014-05-17 22:13:53 UTC
Yes, it seems like we still need a bugzilla category for frameworkintegration. https://git.reviewboard.kde.org/r/120467/ Same here. also opened there: https://bugreports.qt-project.org/browse/QTBUG-41333 Here is the problem: bool KDEPlatformFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) { initializeDialog(); m_dialog->setWindowFlags(windowFlags); m_dialog->setModal(windowModality != Qt::NonModal); if (windowModality == Qt::NonModal) { m_dialog->show(); ... The QtQuick FileDialog is window modal by default. That is not a reason to avoid showing it. Unlike widget-based applications, QtQuick applications cannot call QDialog::exec(). So the modality is just meant to request the window manager to make the window behave as a modal one. So I tried taking out the "if". That makes it work OK with QtQuick. Then I tried qtbase/examples/widgets/dialogs/standarddialogs. If I call any of the static methods (e.g. getOpenFileName()), the dialog appears but is non-interactive, so I can't actually choose a file. We don't have this problem with plain QFileDialog or with any other native dialogs on other platforms, so I'm confident that it can be fixed. Before david ran astyle on that code it used to also call m_dialog->exec() if the dialog was supposed to be modal. With the change here: https://git.reviewboard.kde.org/r/121098/ the QML case works again, but when I try the stanarddialogs test the static methods are making the dialog appear twice in a row for some reason. (In reply to Jeremy Whiting from comment #4) > With the change here: https://git.reviewboard.kde.org/r/121098/ the QML case > works again, but when I try the stanarddialogs test the static methods are > making the dialog appear twice in a row for some reason. That's because m_dialog->exec() is called twice. Once here and once in KDEPlatformFileDialogHelper::exec() Thank you for looking into this. Ok, I confirm I get the same result as you if I just remove the if (that does solve the qml usage also, but when using standarddialogs test the ui shows up but isn't interactive...) *** Bug 344586 has been marked as a duplicate of this bug. *** Git commit 9814e4b773b2b34afafa0c5d242594bbb4f9a6ae by Lukáš Tinkl. Committed on 17/03/2015 at 14:20. Pushed by lukas into branch 'master'. fix native modal file dialogs in QML REVIEW: 120467 M +4 -5 src/platformtheme/kdeplatformfiledialoghelper.cpp http://commits.kde.org/frameworkintegration/9814e4b773b2b34afafa0c5d242594bbb4f9a6ae *** Bug 345002 has been marked as a duplicate of this bug. *** I encounter a problem about filedialog popping up in some qt apps, for example, designer, baka-mplayer with qt-5.5.0, framework-5.12, plasma-5.3.2. It's very easy to reproduce: open filedialog, press 'ESC', again and again, finally(three or four times) the filedialog popup(since 'ESC' key works) but not visible. the main interface of application locked(since it's a modal dialog). As i remember, with qt-5.4.2 also had this problem. At first, I think it belongs to kwin, after tried openbox, there is no improvement. I also tried the git codes of frameworkintegration, the problem remains. Here is the fix. --- frameworkintegration-5.12.0/src/platformtheme/kdeplatformfiledialoghelper.cpp 2015-07-05 08:51:22.000000000 +0000 +++ frameworkintegration-5.12.0n/src/platformtheme/kdeplatformfiledialoghelper.cpp 2015-07-19 14:57:46.891751979 +0000 @@ -303,6 +303,7 @@ m_dialog->show(); KSharedConfig::Ptr conf = KSharedConfig::openConfig(); KWindowConfig::restoreWindowSize(m_dialog->windowHandle(), conf->group("FileDialogSize")); + m_dialog->resize(m_dialog->windowHandle()->size()); return true; } |