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. Qt 4.7.2 - Mac OS X: Cmd+M doesn't minimize my application?!
Forum Updated to NodeBB v4.3 + New Features

Qt 4.7.2 - Mac OS X: Cmd+M doesn't minimize my application?!

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 4.6k 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.
  • A Offline
    A Offline
    agarny
    wrote on last edited by
    #1

    On Mac OS X, to press Cmd+M should minimize the active application. At least, it does for Mac OS X applications that I have tried. However, when it comes to Qt applications, it varies from one application to another. For example, Qt Creator 2.1.0 does minimize, but qtdemo doesn't, and it's the same with my Qt application. I have created and compiled a very basic Qt application, and Cmd+M didn't work either, so that tells me that my application may not be the culprit. In fact, I have checked whether I use Cmd+M as a shortcut in my application, and I don't. Otherwise, thinking that Qt Creator 2.1.0 is compiled with Qt 4.7.1, I thought that maybe something got broken between 4.7.1 and 4.7.2, but I have recompiled my application with Qt 4.7.1 and I am still having the same problem.

    So, as someone experienced / is experiencing the same problem? More importantly, does someone know how to fix this 'problem'?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fxtech
      wrote on last edited by
      #2

      Yep - Qt doesn't implement this default mapping. Apple called me on it when I submitted a Qt-based app to the Mac App Store.

      Just implement your own shortcut and have it connected to the QMainWindow::showMinimized() slot.

      Here is the exact line of code I added to my QMainWindow subclass:

      @new QShortcut(QKeySequence("Ctrl+M"), this, SLOT(showMinimized()));@

      Note that in Qt "Ctrl" is the same as "Cmd" on Mac.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        agarny
        wrote on last edited by
        #3

        Thanks for confirming what I thought might be the case, fxtech. While I am it, are you aware of any other similar mapping that Qt doesn't implement?

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fxtech
          wrote on last edited by
          #4

          If you are developing for the Mac App Store be aware that by default QtCore writes "global" preferences in places it shouldn't (notably to the com.trolltech.plist file). You'll need to manually modify the QSettings code so it doesn't do this. But, this means you'll need to compile your own QtCore and ship it with your app, bundled as a private framework.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fxtech
            wrote on last edited by
            #5

            Oh also note that Qt puts Dock Widget "close" buttons on the right side of the dock titlebar. But on Mac, they need to be on the left. My reviewer was very anal about this and I had to modify my Dock Widgets to have a custom title-bar widget that had the close button on the left. Also you'll need to make sure Dock Window title labels are centered.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              agarny
              wrote on last edited by
              #6

              Ok, thanks god, I have no intention (for now, at least) to have my application on the App Store, but it's still very good to know! If anything, it shows that there is still room for Qt to improve its Mac OS X support (I am still very impressed with Qt though, considering that I work on Windows, Linux and Mac OS X, and that it has been pretty much a breeze to get things to work on all three platforms).

              1 Reply Last reply
              0
              • G Offline
                G Offline
                grego
                wrote on last edited by
                #7

                Did you raise a bug about the Dock Widget buttons on Mac?

                Grego - http://mpaja.com/

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  fxtech
                  wrote on last edited by
                  #8

                  No I never did. I was under the gun to get it working and had to move on to other stuff. I should be more diligent about stuff like this. I have filed bug reports about other things in the past though.

                  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