Question

I have a QLineEdit plus a QListView widget,

  1. When then QListView is visible, the completer should be disabled.
  2. Otherwise the completer is enabled.

But it appears like there's no enable/disable interface for QCompleter. What should I do then?

Was it helpful?

Solution

Removing the completer from the QLineEdit will effectively disable it, you can later set it back again to enable it. To remove it, call QLineEdit::setCompleter(QCompleter*) with a null pointer. Use the same member function to set/restore it again later.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top