Narek Narek - 3 months ago 38
C++ Question

Qt - Esc should not close the dialog

How to make Esc key to minimize a dialog? By default it closes. Should I process

or there is a better way?


I think you may use this:

MyDialog::keyPressEvent(QKeyEvent *e) {
    if(e->key() != Qt::Key_Escape)
    else {/* minimize */}

Also have a look at Events and Event Filters docs.