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. Best way to implement Window menu

Best way to implement Window menu

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.8k 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.
  • C Offline
    C Offline
    Chris H
    wrote on last edited by
    #1

    My program has a Window menu that lists out all of the open windows: each action, when triggered, should raise the selected window and give it keyboard focus. <code>raise()</code> is easy enough, since it's a slot, but it doesn't give the window the input focus. <code>activateWindow()</code> isn't a slot. What is the best way of implementing this behavior? Is there a slot that does this that I'm missing?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      You could derive your windows from your own subclass. In that you can add a new slot that calls raise() and activateWindow(). The other solution would be to add a slot to your main class and do it there. You need to add some bookkeeping about the windows, though.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Chris H
        wrote on last edited by
        #3

        Thanks—I went with your first suggestion, which of course works fine. I find it odd that activateWindow() isn't a slot: do you happen to know the design rationale behind that?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Sorry, I have no clue, why this is not a slot. You might want to file a suggestion on the "public bugtracker":https://bugreports.qt.nokia.com/. So at least it will be reconsidered for the upcoming Qt 5 release later this year.

          http://www.catb.org/~esr/faqs/smart-questions.html

          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