Hi i am new to Qt,

i have added a rect of QGraphicsRectItem and added a member function
void MyRect::keyPressEvent(QKeyEvent *event)
qDebug() << "MyRect knows that you pressed a key";

I have set the flags as well like below

but still when i am clicking on the rectangle, i am not able to see the o/p on console log.
please can any help me out.