http://qt-project.org/doc/qt-5/qwidget.html#keyPressEvent
Note that QKeyEvent starts with isAccepted() == true, so you do not need to call QKeyEvent::ac
Like it says, it is accepted automatically. So if you're handling it, you don't have to do anything. Only if you're not handling the key event you should call ignore()
.
If your class is a subclass of QWidget
, and if you are handling the key event, then do not call the base implementation. If you don't handle it, you can just call the base implementation as it will call ignore().
You can read this, if you want to know more about accepting and ignoring events.
This means if you choose to ignore it, it will be propagated to the parent widget
. If you choose to accept it, it will not be propagated to the parent widget
.
The base class is not the same as the parent widget. Base class is the class your class is derived from. A parent widget is an object that contains this
object as its child widget. This is usually the widget that is passed to your constructor as an argument. But if the parent widget is a QWidget
type, then yes, that would be the case.