petgru
17th July 2007, 11:50
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:
QCompleter *completer = new QCompleter(complist);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::InlineCompletion);
ui.tagEdit->setCompleter(completer);
completer->setCompletionPrefix ( text.split(",").back().trimmed().toLower() );
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.
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:
QCompleter *completer = new QCompleter(complist);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::InlineCompletion);
ui.tagEdit->setCompleter(completer);
completer->setCompletionPrefix ( text.split(",").back().trimmed().toLower() );
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.