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. Hide main window versus Command-H on macos
Forum Updated to NodeBB v4.3 + New Features

Hide main window versus Command-H on macos

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

    Hi, Am a relative newbie to both Qt and Mac and am faced with a problem for which I have exhausted all my attempts to find a resolution.

    Here is my situation.

    1. Developing a Qt App for Mac OS and currently am on OSX 10.7
    2. A requirement for the app is to hide the app when clicked on the "close" button, and it can be accessed anytime by clicking on the system tray icon that the app installs when it is run
    3. When the app is launched, and I hit the Command-H menu item, the app window gets hidden. Now, if I relaunch the app again by double-clicking on the .app, it comes to the foreground as expected.
    4. The same correct behavior occurs if I select "Hide" from the dock icon too.
    5. However, I run into problems when I try hide from the application itself programmatically i.e. when clicking on the "close" button on the title bar. The window is correctly hidden. However, if I try to relaunch the app, it is not appearing. What I have tried is the following:
      a. I simply do a setProperty("visible", false) on the main window when clicked on "close"
      b. I do a NSRunningApplication hide
      c. I do both a and b

    None of these work.

    What I would like to know is how I can simulate a Command-H trigger programmatically. This is because, I know that the chain of events that happen when I do a Command-H results in correct behavior.

    Could someone give me some pointers?

    Thanks!

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What version of Qt are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pullingmyhair
        wrote on last edited by
        #3

        Version 5.4

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pullingmyhair
          wrote on last edited by
          #4

          Anyone has any ideas here ?

          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