It is very simple.
Just create an simple project via wizard, drag a pushbutton to the centerwidget.
and then setWindowFlag(Qt::FramelessWindowHint);, then connect the signal clicked of the button to slot showMinimized() of mainwindow.

If you wan to implement cocoa code shown in my first post, you can add new objc++ source file, and implement the slot function in this objc++ file.