[Qt-interest] QFileDialog, customized filters on the fly?

Daniel Franke franke.daniel at gmail.com
Mon Apr 27 22:21:59 CEST 2009


On Monday 27 April 2009 18:27:17 Torrin Jones wrote:
> On Fri, Apr 24, 2009 at 5:26 AM, Daniel Franke 
<franke.daniel at gmail.com>wrote:
> > Sometimes the static filtering of files in QFileDialog, e.g. "JPEG
> > (*.jpg)", is not enough. Is there a way to allow users to specify custom
> > filters on the fly, e.g. "*x.jpg", to select all jpg-files whose basename
> > ends with an 'x'?
> >
> > KDE does provide this functionality in KFileDialog, but I neither want to
> > re-implement QFileDialog myself nor intrude kdelibs as a dependency. Are
> > there simpler solutions for Qt-only apps?
>
> How about having the user type "*x.jpg" (without the quotes) in the File
> name: text box?

Your suggestion works with the native windows dialog, but not with the Qt 
version on linux. Looking for "*.diff" in a directory that contains multiple 
shows a dialog like:

	"*.diff
	File not found.
	Please verify the correct file name was given"

(Tested with the same application and application version on both platforms.)

Cheers

	Daniel




More information about the Qt-interest-old mailing list