[Qt-interest] QComboBox::setLineEdit()
Joshua Grauman
jnfo-c at grauman.com
Sat Apr 16 23:00:56 CEST 2011
Looks like this can't be done from what I've been reading. You would think
I would know what a virtual function is by now, but at least now I do...
:)
Josh
> Hello again ;)
>
> Ok, so I realized that I didn't have the function signature correct,
> setText() should take a const QString &, which is obvious and I should
> have caught it, but it still isn't calling my setText function after
> fixing that. I'm guessing it has something to do with the signature of the
> function and somehow it's still calling the base class setText, but I
> can't get it to work. Other thoughts? Thanks so much!
>
> Josh
>
>> 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
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list