further refactoring for QCompleter