Keyboard Accelerator with QInputDialog via QWinWidget

  • Dear all,

    I am trying to integrate QT5.3 with a legacy SDI MFC (Visual Studio 2013) app using QTWinMigrate. From an option in the main menu bar, I would like to open a QInputDialog to ask the user for a string. This works fine in principle, but keyboard accelerators (Ctrl+C, Ctrl+V etc) do not work in the QInputDialog:

    @QWinWidget wid((CWnd *) AfxGetMainWnd());
    QString s = QInputDialog::getText(&wid, ...);

    Is this a bug in QWinWidget/QInputDialog? Can I somehow get around it? If I create other types of QT windows with QWinWidget as parent, the keyboard accelerators work fine...


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I can't comment on that but it might be related to the fact that it's a dialog spinning it's own event loop. Can you check with a dummy dialog where your call exec() on ?

  • Hi and thank you for the hint! It's really strange, if I create a QInputDialog without the static function, but using exec(), the accelerators still dont work, whereas any other (custom / dummy) dialog can accept accelerators, if I put a QLineEdit into them...

  • Lifetime Qt Champion

    Then it looks like the local event loop is eating something from your input.

    Does it also happen if you use open rather than exec ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.