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] Window Active Focus signal
Forum Updated to NodeBB v4.3 + New Features

[Solved] Window Active Focus signal

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 8.2k 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.
  • B Offline
    B Offline
    bundickt
    wrote on 2 Aug 2011, 00:41 last edited by
    #1

    Is there a way to know when a window looses active focus without polling isActiveWindow? I would like to connect to a signal if possible.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rokemoon
      wrote on 2 Aug 2011, 05:24 last edited by
      #2

      Try "this":http://doc.qt.nokia.com/latest/qapplication.html#focusChanged or "this":http://doc.qt.nokia.com/latest/qwidget.html#focusInEvent

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on 2 Aug 2011, 05:27 last edited by
        #3

        you are looking for the focus or for isActiveWindow? that's a difference, because for the activeWindow, one child may also have the input focus.

        If it's about activeWindow, you could check "QWidget::changeEvent":http://doc.qt.nokia.com/4.7/qwidget.html#changeEvent and emit a custom signal

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bundickt
          wrote on 2 Aug 2011, 17:25 last edited by
          #4

          I used the focusChanged signal from QApplication.

          I feel like there should be a better way of doing this without having to watch every focus changed event and check if its the focus change I'm looking for.

          Thanks for the help.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on 2 Aug 2011, 18:11 last edited by
            #5

            [quote author="bundickt" date="1312305933"]I feel like there should be a better way of doing this without having to watch every focus changed event and check if its the focus change I'm looking for.[/quote]

            The point here is, there are many things that could be more elegant for few people, but then we would have thousands of signals.

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bundickt
              wrote on 2 Aug 2011, 18:49 last edited by
              #6

              Personally I like the idea of having thousands of signals.

              Qt Quick seems to be designed with this philosophy.

              1 Reply Last reply
              0

              1/6

              2 Aug 2011, 00:41

              • Login

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