views:

329

answers:

4

I've got a basic PyQt QFileDialog file browser goin in Python, Kubuntu.

My issue is I would like the "tab key" in the file input to act as tab-complete does in a shell.

Is there any way to accomplish this?

A: 

You will have to subclass the QFileDialog, and change the behavior. It will probably not be easy.

Marius
A: 

From a UI/UX standpoint are you sure that's what you want? In forms and dialogs tab has traditionally meant go to next field. You might be confusing the user. Or you might start a revolution in User Experience for forms :-)

Just curious if that's what you really want?

Jeremy Wall
yeah its what i want ;) this particular UI im replacing is JUST a unix style path input field. leaving out typical tab-behavior for a UI here is not a problem. what i really want for my script is the ability to query the available paths using the text that is typed in, and if the user presses tab - it completes for them if there is only one option.
mleep
A: 

I haven't made use of PyQt yet, but I think the QCompleter class might be most of the way to what you want:

http://doc.trolltech.com/4.5/tools-completer.html

I don't know if it tab completes or if that's something you'd have to add yourself.

Dave
A: 

I am not sure you can actually, i don't see any access to the input field in the documentation of QFileDialog. Qt is fairly aggressive at hiding implementation detail from it's users. You might be able to do this by taking the implementation of QFileDialog (C++) and modify it for your purpose.

Harald Scheirich
If you take this solution beware of licensing issues. Anyway, I believe you have to do this or roll your own file dialog.
Vitor Py