1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01: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
src/libtomahawk/thirdparty/Qocoa

@ -24,10 +24,15 @@ THE SOFTWARE.
#define QCOCOA_MAC_H
#import <Cocoa/Cocoa.h>
#include <AppKit/NSImage.h>
#include <QString>
#include <QVBoxLayout>
#include <QMacCocoaViewContainer>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <qmacfunctions.h>
#endif
static inline NSString* fromQString(const QString &string)
{
const QByteArray utf8 = string.toUtf8();
@ -44,11 +49,16 @@ static inline QString toQString(NSString *string)
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];
}
static inline void setupLayout(void *cocoaView, QWidget *parent)
static inline void setupLayout(NSView *cocoaView, QWidget *parent)
{
parent->setAttribute(Qt::WA_NativeWindow);
QVBoxLayout *layout = new QVBoxLayout(parent);

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