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. [Solved] Preventing keyboard focus going to QWidget::createWindowContainer widgets
QtWS25 Last Chance

[Solved] Preventing keyboard focus going to QWidget::createWindowContainer widgets

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.7k 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.
  • S Offline
    S Offline
    Sushisource
    wrote on last edited by
    #1

    I realize this is 5.1+ so if there's a better place to ask this, please let me know.

    I've tried
    @container->setFocusPolicy(Qt::NoFocus);@

    I've tried (where parent has the keyboard behavior I want)
    @container->installEventFilter(parent);@

    And even (where view is the QQuickView being embedded by createWindowContainer)
    @view->setKeyboardGrabEnabled(false);@

    But it still hogs focus. Any ideas?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      you could try to reimplement "QWidget::focusNextPrevChild()":http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#focusNextPrevChild and simply return true.
      But i'm not sure if it will help you in this case.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sushisource
        wrote on last edited by
        #3

        Postmortem:
        I fixed this by installing an eventfilter

        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