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

Marius P nmariusp1 at gmail.com
Sun Jun 26 11:38:39 CEST 2022

> filter syntax than Qt (where I don’t think it’s ever been anything else
than what it is today).
If this is the answer to my question.

Then I vote:
* A developer would expect to see QFileDialog used with a filter that
respects the Qt documentation, e.g. "". Instead of a filter that does not
respect the Qt documentation, e.g. "*|All Files".

There are some KDE apps that use just one (simple) filter for QFileDialog.
I want to fix those apps.

On Sun, Jun 26, 2022 at 12:07 PM Volker Hilsheimer <volker.hilsheimer at qt.io>

> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220626/f21a3bef/attachment-0001.htm>

More information about the Development mailing list