1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Updated qocoa.

This commit is contained in:
Christian Muehlhaeuser
2015-01-25 18:41:46 +01:00
parent aacb375483
commit 2597ffb986
2 changed files with 13 additions and 3 deletions

View File

@@ -24,10 +24,15 @@ THE SOFTWARE.
#define QCOCOA_MAC_H #define QCOCOA_MAC_H
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <AppKit/NSImage.h>
#include <QString> #include <QString>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QMacCocoaViewContainer> #include <QMacCocoaViewContainer>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <qmacfunctions.h>
#endif
static inline NSString* fromQString(const QString &string) static inline NSString* fromQString(const QString &string)
{ {
const QByteArray utf8 = string.toUtf8(); const QByteArray utf8 = string.toUtf8();
@@ -44,11 +49,16 @@ static inline QString toQString(NSString *string)
static inline NSImage* fromQPixmap(const QPixmap &pixmap) static inline NSImage* fromQPixmap(const QPixmap &pixmap)
{ {
CGImageRef cgImage = pixmap.toMacCGImageRef(); #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
CGImageRef cgImage = pixmap.toMacCGImageRef();
#else
CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
#endif
return [[[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize] autorelease]; return [[[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize] autorelease];
} }
static inline void setupLayout(void *cocoaView, QWidget *parent) static inline void setupLayout(NSView *cocoaView, QWidget *parent)
{ {
parent->setAttribute(Qt::WA_NativeWindow); parent->setAttribute(Qt::WA_NativeWindow);
QVBoxLayout *layout = new QVBoxLayout(parent); QVBoxLayout *layout = new QVBoxLayout(parent);

View File

@@ -215,7 +215,7 @@ public:
q.data()->accepted(); q.data()->accepted();
} }
QWeakPointer<QToolbarTabDialog> q; QPointer<QToolbarTabDialog> q;
NSWindow* prefsWindow; NSWindow* prefsWindow;
ToolbarDelegate *toolBarDelegate; ToolbarDelegate *toolBarDelegate;