[Qt-interest] QComboBox::setLineEdit()

Joshua Grauman jnfo-c at grauman.com
Sat Apr 16 19:30:14 CEST 2011


Hello,

This should be really easy, but I can't figure it out so maybe someone can 
help me figure out what I'm doing wrong.

I have a QComboBox that I'd like to do some fancy substitutions when 
certain things are typed. I subclasses a QLineEdit and changed the setText 
function to do this. Then I can QComboBox::setLineEdit() with a new 
QLineEdit subclass that I create. However, the setText function never gets 
called on the subclass. Does anyone have any ideas why this could be???

   KLineEdit *kle = new KLineEdit(mainWin->filterCB);
   mainWin->filterCB->setLineEdit(kle);

...

void KLineEdit::setText(QString text)
{
   text.replace("a","b");
   printf("hello!?\n");
   QLineEdit::setText(text);
}

Thanks!

Josh



More information about the Qt-interest-old mailing list