Version: (using Devel) Installed from: Compiled sources Compiler: gcc version 4.2.1 (SUSE Linux) OS: Linux I am using a KComboBox with popup completion to enter an email address, but also allow to use the popup to choose another email from a predefined list. I then connected the KComboBox's "returnPressed()" signal to a slot in my class; but when I press the enter/return key, no signal is emitted; there is no debug message in my console output (all debug areas are enabled from kde4's kdebugdialog) and my method isn't called. That's the same with the returnPressed(const QString &) signal. However, connecting my slot to the internal QLineEdit works as intended, typing the Enter key calls my slot. two examples to clarify. This doesn't work: > connect( handleCombobox_, SIGNAL( returnPressed() ), > this, SLOT ( updateView() ) ); The slot is never called and no debug message is output to console. This does work: > connect( handleCombobox_->lineEdit(), SIGNAL( returnPressed() ), > this, SLOT ( updateView() ) ); The API clearly states the presence of these signals in KComboBox: http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKComboBox.html I looked at the source it should emit at least one of these two signals when the KComboBox has a line edit and is enabled, but I have an enabled QLineEdit into the combobox and they are not emitted at press of the enter key.
The best would be to attach a test case, a minimum program that proves your point.
Created attachment 23561 [details] Simple kde4 test app There you go. I've put together a quick CMake app which connects the returnPressed() signals from KComboBox and the internal QLineEdit. Only the QLineEdit signal though, causes the label to be updated.
Confirmed, not sure what's wrong in the KComboBox code though...
OK, I had a look (since I had written a unittest for this) and I found a workaround: combo_ = new KComboBox( true, this ) makes the combobox work as expected. So the problem is calling setEditable after creation; I'll check why.
SVN commit 774759 by dfaure: Fix KComboBox not emitting returnPressed when it was created with rw=false and setEditable(true) afterwards. It really sucks that QComboBox::setLineEdit() is not virtual anymore. BUG: 157785 M +19 -3 tests/klineedit_unittest.cpp M +3 -0 tests/klineedit_unittest.h M +14 -6 widgets/kcombobox.cpp M +12 -0 widgets/kcombobox.h WebSVN link: http://websvn.kde.org/?view=rev&revision=774759
Thanks for your quick and efficient fix!
:o never saw a quicker resolution... thank you very much! You're all doing an awesome work ;)