Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Keyboard Accelerator with QInputDialog via QWinWidget

Keyboard Accelerator with QInputDialog via QWinWidget

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    magec000
    wrote on last edited by
    #1

    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());
    wid.showCentered();
    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...

    thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        magec000
        wrote on last edited by
        #3

        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...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved