How-to override KeyPressEvent for an editable QCom

2019-08-02 04:27发布

I have a class named ValidableComboBox that derives directly from QComboBox.

Every instance of ValidableComboBox has setEditable() set to true. My goal is to add some signal that will be emitted whenever someone presses return key in the QComboBox.

To do so, I reimplemented void KeyPressEvent(QKeyEvent* e) in ValidableComboBox. However, it seems that it never gets called when I type something into the combobox.

Is there a way to achieve this ? What could possibly be wrong with what I have done ?

Thank you.

1条回答
聊天终结者
2楼-- · 2019-08-02 04:44

The funktion you've seem to be using in your kode has a Kapital K, instead of a small k, ok? :-D

查看更多
登录 后发表回答