[Development] "*|All Files" as filter for QFileDialog

Volker Hilsheimer volker.hilsheimer at qt.io
Sun Jun 26 11:07:17 CEST 2022


> On 26 Jun 2022, at 02:28, Marius P <nmariusp1 at gmail.com> wrote:
> 
> Hello,
> 
> From what I can see, "*|All Files" does not work as filter for QFileDialog if using the Qt file open dialog, not the KDE file open dialog. I am on Kubuntu 22.04. The file open dialog says that I have  zero files in the directory.
> Screenshot https://drive.google.com/file/d/1AW3cMtEggfniVI0jNtR3Fx6iMBidLa-W
> E.g. https://invent.kde.org/multimedia/kmplayer/-/merge_requests/2
> The Qt documentation says that the syntax "*|All Files"is invalid. E.g. https://doc.qt.io/qt-5/qfiledialog.html#getOpenFileNames
> 
> Question: should the non KDE, Qt file open dialog support a syntax like "*|All Files"? Or should I fix more than 12 KDE apps?
> 
> Thanks.

Odd, would be interesting to understand how KFileDialog ended up with a different filter syntax than Qt (where I don’t think it’s ever been anything else than what it is today).

But I see no reason why Qt couldn’t support the filter syntax documented for KFileDialog [1], other than that it introduces a bit of complexity to the code. I suppose we could detect a ‘|’ or '\n’ in the filter string and then implement a different splitting logic in qt_make_filter_list. As long as the QStringList returned from that function is the same for either syntax, the rest of the Qt code an integration with native dialogs shouldn’t require any changes.

Feel free to propose a patch for that.

Volker

[1] https://api.kde.org/legacy/pykde-4.2-api/kio/KFileDialog.html#obj3064034764



More information about the Development mailing list