126 |
126 |
127 class E5StringListCompleter(QCompleter): |
127 class E5StringListCompleter(QCompleter): |
128 """ |
128 """ |
129 Class implementing a completer for string lists. |
129 Class implementing a completer for string lists. |
130 """ |
130 """ |
131 def __init__(self, parent=None, strings=[], |
131 def __init__(self, parent=None, strings=None, |
132 completionMode=QCompleter.PopupCompletion): |
132 completionMode=QCompleter.PopupCompletion): |
133 """ |
133 """ |
134 Constructor |
134 Constructor |
135 |
135 |
136 @param parent parent widget of the completer (QWidget) |
136 @param parent parent widget of the completer (QWidget) |
138 (list of strings) |
138 (list of strings) |
139 @keyparam completionMode completion mode of the |
139 @keyparam completionMode completion mode of the |
140 completer (QCompleter.CompletionMode) |
140 completer (QCompleter.CompletionMode) |
141 """ |
141 """ |
142 super(E5StringListCompleter, self).__init__(parent) |
142 super(E5StringListCompleter, self).__init__(parent) |
143 self.__model = QStringListModel(strings, parent) |
143 self.__model = QStringListModel( |
|
144 [] if strings is None else strings[:], |
|
145 parent) |
144 self.setModel(self.__model) |
146 self.setModel(self.__model) |
145 self.setCompletionMode(completionMode) |
147 self.setCompletionMode(completionMode) |
146 if parent: |
148 if parent: |
147 parent.setCompleter(self) |
149 parent.setCompleter(self) |