(self, text)
Set `text` as the current text (adding it to the model if necessary).
Set `text` as the current text (adding it to the model if necessary).
Set text as the current text ( adding it to the model if necessary ) .
def setText(self, text):
        # type: (str) -> None
        """
        Set `text` as the current text (adding it to the model if necessary).
        """
        idx = self.findData(text, Qt.EditRole, Qt.MatchExactly)
        if idx != -1:
            self.setCurrentIndex(idx)
        else:
            self.addItem(text)
            self.setCurrentIndex(self.count() - 1)
def setText ( self , text ) : # type: (str) -> None idx = self . findData ( text , Qt . EditRole , Qt . MatchExactly ) if idx != - 1 : self . setCurrentIndex ( idx ) else : self . addItem ( text ) self . setCurrentIndex ( self . count ( ) - 1 )