https://bugs.kde.org/show_bug.cgi?id=406464
Bug ID: 406464 Summary: Unexpected folder selection in native QFileDialog Product: plasma-integration Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: plasma-b...@kde.org Reporter: m.wegh...@posteo.de Target Milestone: --- Created attachment 119370 --> https://bugs.kde.org/attachment.cgi?id=119370&action=edit Sample program that opens QFileDialog to select directory SUMMARY When using the native Plasma file dialog to select a directory, clicking on a directory and confirming will not select the selected directory, but the "base directory" currently shown in the dialog. STEPS TO REPRODUCE 1. create test directories: 'mkdir /tmp/testdir/subdir' 2. compile attached sample program ("main.cpp") that opens a file dialog to select a directory 3. start the program 4. navigate into directory "/tmp/testdir" 5. click on directory "subdir" 6. click the "Open" button -> dialog closes 7. check what directory has been selected (printed on stdout for the sample program) OBSERVED RESULT The folder "/tmp/testdir/" has been selected. EXPECTED RESULT Expected result: The folder "/tmp/testdir/subdir" should be selected. SOFTWARE/OS VERSIONS Debian Operating System: Debian GNU/Linux testing (with plasma-integration 5.14.5-1, libkf5kiowidgets5 5.54.1-1) KDE Plasma Version: 5.14.5 Qt Version: 5.11.3 KDE Frameworks Version: 5.54.0 Kernel Version: 4.19.0-4-amd64 OS Type: 64-bit ADDITIONAL INFORMATION * The non-native QFileDialog behaves as expected, which can be tested by forcing QFileDialog to use non-native mode (s. line 11, currently commented out). When clicking a directory, it updates that shown path accordingly and the test program prints the path after clicking the "Choose" button. * The attached screenshots show the native and non-native dialogs at the point in time the corresponding buttons are clicked. * The Qt documentation for QFileDialog ([1]) mentions: "Returns a list of strings containing the absolute paths of the selected files in the dialog. If no files are selected, or the mode is not ExistingFiles or ExistingFile, selectedFiles() contains the current path in the viewport." -- I don't thinks this describes what happens here, though. * Commenting out 'dialog.setFileMode(QFileDialog::FileMode::Directory);' in line 12 in the sample program makes the QFileDialog behave as expected. However, that will make folder selection impossible with the non-native QFileDialog (so behaviour differs here as well). [1] https://doc.qt.io/qt-5/qfiledialog.html#selectedFiles -- You are receiving this mail because: You are watching all bug changes.