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. Cmd-H shortcut on Mac OS
Forum Updated to NodeBB v4.3 + New Features

Cmd-H shortcut on Mac OS

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

    Hi all,

    I'm developing a background application without menu nor dock icon, and only a systray icon.
    When I show the main window, I can close it with Cmd-W by overloading the keyPressEvent method.
    I'm using hide() and show() on myQWidget.
    When I hide the same window by using Cmd-H, it hides, but the show() method on it does not call it back. I have to quit my program and restart to be able to see the window back.

    What would be the right way to hide the window properly or set it back without show() ? I tried showNormal() too and it didn't resolv my problem.

    Thank you !

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

      If you press Cmd-H on Mac OS X the widget is hidden with the operating system's methods. It is another kind of hide than with the hide() slot. In case of Cmd-H hide, the window appears in the dock (as far as I know you cannot prevent this - if it's possible I'd like to know how).

      You can add a menu entry to the systray icon and connect the actions's triggered() to the slot raise() of your window. At least with a regular QMainWindow this works. You might have to call activateWindow() too.

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

      1 Reply Last reply
      0
      • E Offline
        E Offline
        esteban
        wrote on last edited by
        #3

        Amazing !

        Thank you very much, it worked ! I already had a menu entry to open my window and I simply added a raise() and an activateWindow() and my window appears !

        Regards

        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