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

Albert Astals Cid aacid at kde.org
Mon Jul 4 00:39:59 CEST 2022


El diumenge, 26 de juny de 2022, a les 11:07:17 (CEST), Volker Hilsheimer va 
escriure:
> > 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]

Honestly I don't think this makes sense.

Using KFileWidget syntax (KFileDialog is deprecated since lots of years) on a 
QFileDialog is just wrong and the code should be fixed.

Cheers,
  Albert

> 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
> 
 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development






More information about the Development mailing list