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. Focus of shortcut
QtWS25 Last Chance

Focus of shortcut

Scheduled Pinned Locked Moved General and Desktop
shortcutmodal dialog
3 Posts 2 Posters 1.5k Views
  • 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.
  • L Offline
    L Offline
    ling32945
    wrote on 15 Sept 2015, 08:36 last edited by
    #1

    I've created two windows, one is the main window, the other one is the child window of main window. I've set window modality of the child window. On the child window, the menu bar of main window was set to disabled, but when I press the shortcut "Command + V" the main window menu bar responded(it showed that the menu Edit has been activated) , there is noting pasted on the child window. But if I right click and select the Paste, it works well.
    If I click the menu bar then paste on child window, the shortcut work well.
    So, I am wondering whether the child window doesn't get the shortcut focus. If there any one help me to solve this issue, thanks.

    Following are the code of child window.

    childWindow->setWindowModality(Qt::ApplicationModal);
    childWindow->setWindowFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::WindowTitleHint); 
    childWindow->exec()
    

    Best Regards

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 15 Sept 2015, 20:21 last edited by
      #2

      Hi,

      IIRC, you have to associate your action to each widget it should act with. You can do that with QWidget::addAction.

      Hope it helps

      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
      • L Offline
        L Offline
        ling32945
        wrote on 16 Sept 2015, 00:37 last edited by
        #3

        Hi SGaist,

        Thanks for your reply.

        I don't think it caused by missing QWidget::addAction, because sometimes the shortcuts works well.
        I've used the default shortcuts of widget(copy, paste and cut). It's strange that after the child window lunched the shortcuts don't work, but after click the Main window's menu bar(even the button in menu is disabled), the shortcuts works well. So i suspected whether there is the shortcut focus.

        1 Reply Last reply
        0

        3/3

        16 Sept 2015, 00:37

        • Login

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