PDA

View Full Version : Clearing editted text from ComboBox on return



cnbp173
3rd February 2011, 20:02
As the title says.

If I enter a value into an editable combobox and then hit return, I'll looking to be able to clear the combobox, ready for the next input.

Thoughts? Suggestions?

R

high_flyer
3rd February 2011, 20:29
Since you are using an editable combox it has a QLineEdit asociated with it. see QComboBox::lineEdit () .
QLineEdit has the editingFinished () signal.

cnbp173
3rd February 2011, 22:41
Hi there,

I tried this, but to no avail. I tried:

connect(comboBox,SIGNAL(editingFinished()),comboBo x,SLOT(clearEditText()));

Is this right? or is there a specific way to cast to the lineEdit functions

R

Added after 19 minutes:


Hi there,

I tried this, but to no avail. I tried:

connect(comboBox,SIGNAL(editingFinished()),comboBo x,SLOT(clearEditText()));

Is this right? or is there a specific way to cast to the lineEdit functions

R

OK, sorry for being blonde......

works with

connect(comboBox->lineEdit(),SIGNAL(editingFinished()),comboBox,SLOT (clearEditText()));