Remove use of some deprecated code and cleanup other macOS code
This commit is contained in:
@@ -27,30 +27,33 @@ THE SOFTWARE.
|
||||
#include <QtMacExtras>
|
||||
#include <QMacCocoaViewContainer>
|
||||
|
||||
static inline NSString* fromQString(const QString &string)
|
||||
{
|
||||
const QByteArray utf8 = string.toUtf8();
|
||||
const char* cString = utf8.constData();
|
||||
return [[NSString alloc] initWithUTF8String:cString];
|
||||
static inline NSString* fromQString(const QString &string) {
|
||||
|
||||
const QByteArray utf8 = string.toUtf8();
|
||||
const char* cString = utf8.constData();
|
||||
return [ [NSString alloc] initWithUTF8String:cString];
|
||||
|
||||
}
|
||||
|
||||
static inline QString toQString(NSString *string)
|
||||
{
|
||||
if (!string)
|
||||
return QString();
|
||||
return QString::fromUtf8([string UTF8String]);
|
||||
static inline QString toQString(NSString *string) {
|
||||
|
||||
if (!string) return QString();
|
||||
return QString::fromUtf8([string UTF8String]);
|
||||
|
||||
}
|
||||
|
||||
static inline NSImage* fromQPixmap(const QPixmap &pixmap)
|
||||
{
|
||||
CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
|
||||
return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
|
||||
static inline NSImage* fromQPixmap(const QPixmap &pixmap) {
|
||||
|
||||
CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
|
||||
return [ [NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
|
||||
|
||||
}
|
||||
|
||||
static inline void setupLayout(NSView *cocoaView, QWidget *parent)
|
||||
{
|
||||
parent->setAttribute(Qt::WA_NativeWindow);
|
||||
QVBoxLayout *layout = new QVBoxLayout(parent);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(new QMacCocoaViewContainer(cocoaView, parent));
|
||||
static inline void setupLayout(NSView *cocoaView, QWidget *parent) {
|
||||
|
||||
parent->setAttribute(Qt::WA_NativeWindow);
|
||||
QVBoxLayout *layout = new QVBoxLayout(parent);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(new QMacCocoaViewContainer(cocoaView, parent));
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user