diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2014-02-22 21:39:16 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-24 15:32:43 +0100 |
commit | 219ae0067c382f12734ad8be23faffe12cda87ab (patch) | |
tree | 9b971eb0f0f6cf1c588f0e6477dc0b7ce70c7c1c /src | |
parent | e59591107e6356e385db791fe1dc8176c8a2d170 (diff) |
Document qtmacextras functions
This patch aims to provide the missing Qt Mac Extras documentation
The conversion functions (e.g. NSData <=> QByteArray) are not
documented because they will either be moved to QtCore or
removed from QtMacExtras since already present in QtCore
Change-Id: I364be524966b353602bcf88218d9bb81042497ff
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/macextras/qmacfunctions_ios.mm | 15 | ||||
-rw-r--r-- | src/macextras/qmacfunctions_mac.mm | 24 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/macextras/qmacfunctions_ios.mm b/src/macextras/qmacfunctions_ios.mm index ddc6a03..fa83ce6 100644 --- a/src/macextras/qmacfunctions_ios.mm +++ b/src/macextras/qmacfunctions_ios.mm @@ -49,16 +49,31 @@ QT_BEGIN_NAMESPACE namespace QtMac { +/*! + Returns the current CoreGraphics context. +*/ CGContextRef currentCGContext() { return UIGraphicsGetCurrentContext(); } +/*! + Sets the value shown on the application icon a.k.a badge. + + Unlike its OS X counterpart, only numbers can be used. + + \sa applicationIconBadgeNumber(), setBadgeLabelText() +*/ void setApplicationIconBadgeNumber(int number) { [[UIApplication sharedApplication] setApplicationIconBadgeNumber: number]; } +/*! + Returns the value of the application icon a.k.a badge. + + \sa setApplicationIconBadgeNumber(), badgeLabelText() +*/ int applicationIconBadgeNumber() { return [[UIApplication sharedApplication] applicationIconBadgeNumber]; diff --git a/src/macextras/qmacfunctions_mac.mm b/src/macextras/qmacfunctions_mac.mm index 9901314..88ebb61 100644 --- a/src/macextras/qmacfunctions_mac.mm +++ b/src/macextras/qmacfunctions_mac.mm @@ -57,6 +57,12 @@ QT_BEGIN_NAMESPACE namespace QtMac { +/*! + Creates an \c NSImage equivalent to the QPixmap. Returns the \c NSImage handle. + + It is the caller's responsibility to release the \c NSImage data + after use. +*/ NSImage* toNSImage(const QPixmap &pixmap) { NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:toCGImageRef(pixmap)]; @@ -67,6 +73,9 @@ NSImage* toNSImage(const QPixmap &pixmap) } #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +/*! + Returns whether the given QWindow is the application's main window +*/ bool isMainWindow(QWindow *window) { NSWindow *macWindow = static_cast<NSWindow*>( @@ -78,16 +87,31 @@ bool isMainWindow(QWindow *window) } #endif +/*! + Returns the current CoreGraphics context. +*/ CGContextRef currentCGContext() { return reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); } +/*! + Sets the text shown on the application icon a.k.a badge. + + This is generally used with numbers (e.g. number of unread emails); it can also show a string. + + \sa badgeLabelText() +*/ void setBadgeLabelText(const QString &text) { [[[NSApplication sharedApplication] dockTile] setBadgeLabel:toNSString(text)]; } +/*! + Returns the text of the application icon a.k.a badge. + + \sa setBadgeText() +*/ QString badgeLabelText() { return fromNSString([[[NSApplication sharedApplication] dockTile] badgeLabel]); |