Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

QtMac Namespace

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

Header: #include <QtMac>
qmake: QT += macextras
Since: Qt 5.2

Functions

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

Detailed Description

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

Function Documentation

int QtMac::applicationIconBadgeNumber()

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

See also setApplicationIconBadgeNumber() and badgeLabelText().

QString QtMac::badgeLabelText()

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

See also 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.

See also toCGImageRef() and Pixmap Conversion.

bool QtMac::isMainWindow(QWindow *window)

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

void QtMac::setApplicationIconBadgeNumber(int number)

Sets the value shown on the application icon a.k.a badge to number.

Unlike its macOS counterpart, only numbers can be used.

See also applicationIconBadgeNumber() and setBadgeLabelText().

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.

See also 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.

See also 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.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded