Skip to content

Commit

Permalink
add completer for label
Browse files Browse the repository at this point in the history
  • Loading branch information
GolovanovSrg authored and tzutalin committed Mar 31, 2018
1 parent 357018b commit ca10b0d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/labelDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ class LabelDialog(QDialog):

def __init__(self, text="Enter object label", parent=None, listItem=None):
super(LabelDialog, self).__init__(parent)

self.edit = QLineEdit()
self.edit.setText(text)
self.edit.setValidator(labelValidator())
self.edit.editingFinished.connect(self.postProcess)

model = QStringListModel()
model.setStringList(listItem)
completer = QCompleter()
completer.setModel(model)
self.edit.setCompleter(completer)

layout = QVBoxLayout()
layout.addWidget(self.edit)
self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
Expand Down

0 comments on commit ca10b0d

Please sign in to comment.