PDA

View Full Version : QComboBox current text is empty, but currentText() got "("



jasonhxs
12th August 2014, 07:26
Hi,

I connect a slot to signal: editTextChanged(const QString&).
It is ok to receive current text by the slot each time when I key-in something.
But when I "backspace" to clear the string in QComboBox, currentText() still return "(".

jasonhxs
27th August 2014, 04:16
Hi all,

I found the root-cause, it was from the usage of qPrintable().
This function will convert QString to char*, and the string pointer may be freed after the calling.
So I should keep the string immediately after qPrintable(), that is it!