Help using QCompleter with QFileSystemModel

  • I want to adapt the 'customcompleter' example ( to use a file system completer instead of reading out of the word list.

    The docs say you can use a QFileSystemModel using the following (

    @ QCompleter *completer = new QCompleter(this);
    completer->setModel(new QDirModel(completer));

    [Typo, btw.] So in the example, I tried changing:

    @ completer->setModel(modelFromFile(":/resources/wordlist.txt"));@


    @ QFileSystemModel * model = new QFileSystemModel(completer);

    (I also tried it without the setRootPath call, passing in "." and "/", and with QDirModel instead.)

    It no longer works: the completion window does not appear either on its own or when called with ctrl-E. What am I doing wrong?

  • Oh, I guess I should say that I'm using Qt 4.8.1 on Linux.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.