QCompleter 强制双输入
我有一个 QCompleter,当弹出窗口可见但不用于选择项目时,它强制我的用户按 Enter 键两次。与已完成相关联的 QComboBox 模型用作完成器的模型。
QCompleter *completer = new QCompleter(this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::PopupCompletion);
completer->setModel(this->ui->comboBox->model());
this->ui->comboBox->setCompleter(completer);
当用户输入项目时,可能完成的列表会增加。如果他们开始输入简短的补全(例如“dir”),而有更长的补全可用,并且他们没有从弹出窗口中选择任何内容(即激活的、突出显示的或索引更改都没有被触发),那么他们将被迫再次按回车键处理他们输入的文本。有没有一个简单的方法可以解决这个问题?
谢谢
I have a QCompleter that is forcing my users to hit enter twice when the popup is visible but is not used to select an item. The model for the QComboBox associated to the completed is used as the model for the completer.
QCompleter *completer = new QCompleter(this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::PopupCompletion);
completer->setModel(this->ui->comboBox->model());
this->ui->comboBox->setCompleter(completer);
As the user enters items the list of possible completions grows. If they start to type short completions (e.g. "dir") where there are longer completions available, and they hit without choosing anything from the popup (i.e. neither activated, highlited, or indexchanged get fired) then they are forces to hit enter again to process the text they entered. Is there a simple way around this?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我用 Qt 4.6.2 和 Visual 2008 尝试过,你描述的情况没有发生。如果您想尝试,可用项目。
编译,启动,输入“something”,然后在组合框中重新启动:它已注册,输入“some”并返回:您的组合框现在有“some”和“somewhere”
I tried it with Qt 4.6.2 and Visual 2008 and the situation you describe does not happen. project available if you want to try.
Compile, start, type 'something' then returb in combobox : it's registered, type 'some' and return : your combobox now has "some" and "somewhere"