diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2011-02-25 14:38:48 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2011-02-25 14:38:48 +0100 |
commit | 72928bb61d5aceac1d15ee11736941c16b83df59 (patch) | |
tree | c2daa6c1cf39c963825f4053b495f4b8c688b1e2 /doc | |
parent | 73ae8a593b96ead99dabb854b20a687aa849b71b (diff) | |
download | qt4-tools-72928bb61d5aceac1d15ee11736941c16b83df59.tar.gz |
Doc: inform better about how you can tweak Qt apps on Mac
Just some update on the Mac platform documentation
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/platforms/platform-notes.qdoc | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index aac6bb0a60..246f72129b 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -602,6 +602,69 @@ problem, it probably is a good idea to turn off precompiled headers. Also, consider filing a bug report with Apple so that they can improve support for this feature. + + \section2 Attributes + The following lists a set of useful attributes that can be used to tweak applications + on Mac: + + Qt::AA_MacPluginApplication, Qt::AA_DontUseNativeMenuBar, Qt::AA_MacDontSwapCtrlAndMeta + Qt::WA_MacNoClickThrough, Qt::WA_MacOpaqueSizeGrip, Qt::WA_MacShowFocusRect, + Qt::WA_MacNormalSize, Qt::WA_MacSmallSize, Qt::WA_MacMiniSize, Qt::WA_MacVariableSize, + Qt::WA_MacBrushedMetal, Qt::WA_MacAlwaysShowToolWindow, Qt::WA_MacFrameworkScaled, + Qt::WA_MacNoShadow, Qt::Sheet, Qt::Drawer, Qt::MacWindowToolBarButtonHint, + QMainWindow::unifiedTitleAndToolBarOnMac + + \section2 Mixing Qt with native code + Two classes are awailable for either adding native Cocoa views/controls + inside a Qt application, or the opposite, embedding Qt into a native + Cocoa application: + + QMacCocoaViewContainer, QMacNativeWidget + + \section3 Using native Cocoa panels + Launching native Cocoa panels from within a Qt application can sometimes + be problematic. The reason is that Qt's event dispatcher is more flexible + than what Cocoa offers, and lets the user spin the event dispatcher (and + running QEventLoop::exec) without having to think about whether or not modal + dialogs are showing on screen (which is a difference to Cocoa). Therefore + we need to do special bookkeeping in Qt to handle this correctly, which + unfortunately make mixing in native panels hard. The best way at the moment + to do this, is to follow the pattern below, where we post the call to the + function with native code rather than calling it directly. Then we now that + Qt has cleanly updated any pending event loop recursions before the native + panel is shown: + + \code + #include <QtGui> + + class NativeProxyObject : public QObject + { + Q_OBJECT + public slots: + void execNativeDialogLater() + { + QMetaObject::invokeMethod(this, "execNativeDialogNow", Qt::QueuedConnection); + } + + void execNativeDialogNow() + { + NSRunAlertPanel(@"A Native dialog", @"", @"OK", @"", @""); + } + + }; + + #include "main.moc" + + int main(int argc, char **argv){ + QApplication app(argc, argv); + NativeProxyObject proxy; + QPushButton button("Show native dialog"); + QObject::connect(&button, SIGNAL(clicked()), &proxy, SLOT(execNativeDialogLater())); + button.show(); + return app.exec(); + } + + \endcode */ /*! |