I am developing a QT application on redhat linux, I want to capture Carriage Return press event on QComboBox, I have written Signal for editTextChanged(), it is fired for every key press but not for Enter Key.. Why it is so? If there is any other way to capture carriage return..??
I am assuming you wrote a slot& connected it to editTextChanged() signal of QComboBox. This signal is changed when the text changes and Enter does not change the text, it accepts it. If you want to capture Carriage Return, there are a number of ways you can follow.
1 - Subclass QComboBox. Override keyPressEvent(). In the overridden keyPressEvent(), first call QComboBox::keyPressEvent() & then check if the pressed key is Enter. If it is, emit a signal. Use this subclass whenever you need. Search about promoting widgets in QDesigner if you don't know how.
2 - Implement a new class which inherits QObject. In this class, override eventFilter(). In the eventFilter, check if the event is a key press. If it is, check if it is the Enter key. If it is, emit a signal. Then, create an instance of this class & set it as event filter to your QComboBox. Connect a slot to this instance's signal, which you implemented.
If these are not clear, i recommend reading the following pages:
You could also look into the activated( const QString& )
signal. It might be emitted when the user hits enter.