QtMac Namespace

The QtMac namespace contains miscellaneous functionality specific to the macOS and iOS operating systems. 更多...

头文件: #include <QtMac>
qmake: QT += macextras
开始支持版本: Qt 5.2

Functions

QString badgeLabelText()
CGContextRef currentCGContext()
QPixmap fromCGImageRef(CGImageRef image)
bool isMainWindow(QWindow *window)
void setBadgeLabelText(const QString &text)
CGImageRef toCGImageRef(const QPixmap &pixmap)
NSImage *toNSImage(const QPixmap &pixmap)

详细描述

The QtMac namespace contains miscellaneous functionality specific to the macOS and iOS operating systems.

函数

QString QtMac::badgeLabelText()

Returns the text of the application icon a.k.a badge.

参见 setBadgeLabelText().

CGContextRef QtMac::currentCGContext()

Returns the current CoreGraphics context.

QPixmap QtMac::fromCGImageRef(CGImageRef image)

Returns a QPixmap that is equivalent to the given image.

This function is not available in Qt 5.x until 5.0.2 and will return a null pixmap in earlier versions.

参见 toCGImageRef() and Pixmap Conversion.

bool QtMac::isMainWindow(QWindow *window)

Returns whether the given QWindow window is the application's main window

void QtMac::setBadgeLabelText(const QString &text)

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.

参见 badgeLabelText().

CGImageRef QtMac::toCGImageRef(const QPixmap &pixmap)

Creates a CGImageRef equivalent to the QPixmap pixmap. Returns the CGImageRef handle.

It is the caller's responsibility to release the CGImageRef data after use.

This function is not available in Qt 5.x until 5.0.2 and will return NULL in earlier versions.

参见 fromCGImageRef().

NSImage *QtMac::toNSImage(const QPixmap &pixmap)

Creates an NSImage equivalent to the QPixmap pixmap. Returns the NSImage handle.

It is the caller's responsibility to release the NSImage data after use.