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. Get active child widget
Forum Updated to NodeBB v4.3 + New Features

Get active child widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 270 Views 2 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.
  • A Offline
    A Offline
    Alexey Serebryakov
    wrote on last edited by Alexey Serebryakov
    #1

    Hi guys,
    I have QWidget derrived as main widget of application. Also has inside some QDockWidget derrived widgets. How can I get an active/focused dock widget from main widget at this moment?

    Qt 5.15

    Thanks a lot!

    C 1 Reply Last reply
    0
    • A Alexey Serebryakov

      Hi guys,
      I have QWidget derrived as main widget of application. Also has inside some QDockWidget derrived widgets. How can I get an active/focused dock widget from main widget at this moment?

      Qt 5.15

      Thanks a lot!

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      QDockWidgets normally live inside a QMainWindow dock area when they are not floating, so the nature of your program is a little bit unclear.

      QWidget::focusWidget() or QApplication::focusWidget() will tell you where input focus is. If that is inside (a descendant child) one of your dock widgets then you have your answer.

      Axel SpoerlA 1 Reply Last reply
      2
      • C ChrisW67

        QDockWidgets normally live inside a QMainWindow dock area when they are not floating, so the nature of your program is a little bit unclear.

        QWidget::focusWidget() or QApplication::focusWidget() will tell you where input focus is. If that is inside (a descendant child) one of your dock widgets then you have your answer.

        Axel SpoerlA Offline
        Axel SpoerlA Offline
        Axel Spoerl
        Moderators
        wrote on last edited by
        #3

        Adding to @ChrisW67:
        QApplication::focusWidget() tells you the widget (if any), that currently gets input focus.

        widget->focusWidget() isn’t static, has to be called on a widget. It returns what has focus, if widget->window() got activated.

        Software Engineer
        The Qt Company, Oslo

        1 Reply Last reply
        1

        • Login

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