Hello,

I'm currently developing a tagging-dialog for a media company using qt4 on their client software. The dialog has a QLineEdit where you is supposed to be able to enter a comma separated list of tags. A feature we have been looking to add to this is auto-completion of the tags.

This is the current code:
Qt Code:
  1. QCompleter *completer = new QCompleter(complist);
  2. completer->setCaseSensitivity(Qt::CaseInsensitive);
  3. completer->setCompletionMode(QCompleter::InlineCompletion);
  4. ui.tagEdit->setCompleter(completer);
  5. completer->setCompletionPrefix ( text.split(",").back().trimmed().toLower() );
To copy to clipboard, switch view to plain text mode 

It works ok for the first word, when you start writing on a empty line. But I also want it to work, as if it was a blank line, after a comma. ie. if you write "indie, roc" the last word should inline-complete to rock the sameway as if you only wrote "roc". Hope that make sens.