Try to search your question here, if you can't find : Ask Any Question Now ?

Inside eventFilter(), event->type() is stuck at QEvent::Type(Paint)

HomeCategory: stackoverflowInside eventFilter(), event->type() is stuck at QEvent::Type(Paint)
rupesh asked 3 weeks ago

bool Lotto::eventFilter ( QObject *obj, QEvent *event )
{

if (event->type()==QEvent::KeyPress ) {
    QKeyEvent* key = static_cast<QKeyEvent*>(event);
    if ( (key->key()==Qt::Key_Enter) || (key->key()==Qt::Key_Return) ) {
        qInfo()<<"Enter or return was pressed";
    } else {
        qInfo()<<" not enter";
        return QObject::eventFilter(obj, event);
    }
    return true;
} else {
    qInfo()<<"not keypress : "<<event->type()<<obj;
    return QObject::eventFilter(obj, event);
}

}


(There is a timer in my code, which sets a label text as current time at every second. ) I need to detect the press of enter key!

1 Answers
Best Answer
naveen answered 3 weeks ago
Your Answer

9 + 17 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com