[Interest] [OS X] State of Qt Mac Extras?
Till Oliver Knoll
till.oliver.knoll at gmail.com
Sun Feb 9 19:41:34 CET 2014
What is the state of the Qt MacExtras module, specifically in Qt 5.2.1?
I am asking because I was trying to use the documented
NSString * QtMac::toNSString(const QString & string)
function (https://qt-project.org/doc/qt-5/qtmac.html), but in my stock
binary download of the Qt 5.2.1 Mac desktop edition this is all I get in
the corresponding header:
// qmacfunctions.h
namespace QtMac
{
Q_MACEXTRAS_EXPORT NSData *toNSData(const QByteArray &data);
Q_MACEXTRAS_EXPORT QByteArray fromNSData(const NSData *data);
Q_MACEXTRAS_EXPORT CGImageRef toCGImageRef(const QPixmap &pixmap);
Q_MACEXTRAS_EXPORT QPixmap fromCGImageRef(CGImageRef image);
Q_MACEXTRAS_EXPORT CGContextRef currentCGContext();
#ifndef Q_OS_IOS
Q_MACEXTRAS_EXPORT NSImage *toNSImage(const QPixmap &pixmap);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_MACEXTRAS_EXPORT bool isMainWindow(QWindow *window);
#endif
#endif
}
So no to/from NSString functions present! Have they been removed at
short notice, or is the header "outdated" and does not match with the
rest of the library?
It's funny, because when I follow some random google search result I do
find e.g.
https://qt.gitorious.org/qt/qtmacextras/source/1ef71fcdb15ac0b93751142629b4a2d1ab1e73c8:src/macextras/qmacfunctions.mm
where the function is apparently implemented as
NSString *toNSString(const QString &string)
{
return [NSString stringWithCharacters:reinterpret_cast<const
UniChar*>(string.unicode()) length:string.length()];
}
And the corresponding header does include that function:
https://qt.gitorious.org/qt/qtmacextras/source/1ef71fcdb15ac0b93751142629b4a2d1ab1e73c8:src/macextras/qmacfunctions.h
Off course I have no idea to what version that Git commit actually
belongs to (could be a post Qt 5.2.1 commit)
Is there something wrong with that function and it was removed at short
notice? So how come the function is still documented as such in the Qt
5.2 documenation?
Cheers, Oliver
More information about the Interest
mailing list