In Qt 4 setCurrentText ( const QString & text ) is deprecated. The docs say that I should use setItemText() instead. But I'm afraid setItemText() is not completely equivalent to setCurrentText().

In editable comboboxes it was very useful to me. I just passed the text and if there was already an item with that text, it was automatically selected. Otherwise the text appeared to be edited.

But now setItemText() is only to change existing items. setEditText() is quite similar but it doesn't select an existing item if it matches with the text.

So I don't understand why setCurrentText() has been deprecated if there's no equivalent. In fact, this is the implementation that appears in qcombobox.h:

Qt Code:
  1. inline QT3_SUPPORT void setCurrentText(const QString& text) {
  2. int i = findText(text);
  3. if (i != -1)
  4. setCurrentIndex(i);
  5. else if (isEditable())
  6. setEditText(text);
  7. else
  8. setItemText(currentIndex(), text);
  9. }
To copy to clipboard, switch view to plain text mode 

And if setCurrentText() is deprecated... why currentText() is not?

So, the question, is there an easy way to replace setCurrentText() in Qt 4?