Narek Narek - 1 year ago 101
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download