Use dot syntax

This commit is contained in:
Jonathan Schleifer 2019-03-15 01:07:00 +01:00
parent e5a0058952
commit 5b48e3eb1e
No known key found for this signature in database
GPG key ID: 79D21189A2D4708D
31 changed files with 98 additions and 90 deletions

View file

@ -31,10 +31,11 @@
@property (readonly, nonatomic, getter=isPolished) bool polished; @property (readonly, nonatomic, getter=isPolished) bool polished;
@property (readonly, nonatomic, getter=isRemoved) bool removed; @property (readonly, nonatomic, getter=isRemoved) bool removed;
- initWithQEvent: (QEvent *)event OF_UNAVAILABLE; - (instancetype)initWithQEvent: (QEvent *)event OF_UNAVAILABLE;
- initWithQChildEvent: (QChildEvent *)qChildEvent OF_DESIGNATED_INITIALIZER; - (instancetype)initWithQChildEvent:
- initWithType: (QChildEvent::Type)type (QChildEvent *)qChildEvent OF_DESIGNATED_INITIALIZER;
child: (QtObject *)child; - (instancetype)initWithType: (QChildEvent::Type)type
child: (QtObject *)child;
@end @end
namespace ObjQt { namespace ObjQt {
@ -52,7 +53,7 @@ toOF(QChildEvent *qChildEvent)
static OF_INLINE QChildEvent * static OF_INLINE QChildEvent *
toQt(QtChildEvent *childEvent) toQt(QtChildEvent *childEvent)
{ {
return [childEvent qChildEvent]; return childEvent.qChildEvent;
} }
} }

View file

@ -27,18 +27,18 @@ using ObjQt::toOF;
using ObjQt::toQt; using ObjQt::toQt;
@implementation QtChildEvent @implementation QtChildEvent
- initWithQEvent: (QEvent *)event - (instancetype)initWithQEvent: (QEvent *)event
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQChildEvent: (QChildEvent *)event - (instancetype)initWithQChildEvent: (QChildEvent *)event
{ {
return [super initWithQEvent: event]; return [super initWithQEvent: event];
} }
- initWithType: (QChildEvent::Type)type - (instancetype)initWithType: (QChildEvent::Type)type
child: (QtObject *)child child: (QtObject *)child
{ {
try { try {
self = [self initWithQChildEvent: self = [self initWithQChildEvent:

View file

@ -30,8 +30,8 @@
@property (nonatomic, copy) OFString *organizationDomain, *organizationName; @property (nonatomic, copy) OFString *organizationDomain, *organizationName;
@property (nonatomic, getter=isQuitLockEnabled) bool quitLockEnabled; @property (nonatomic, getter=isQuitLockEnabled) bool quitLockEnabled;
- initWithQObject: (QObject *)qObject OF_UNAVAILABLE; - (instancetype)initWithQObject: (QObject *)qObject OF_UNAVAILABLE;
- initWithQCoreApplication: (QCoreApplication *)qCoreApplication - (instancetype)initWithQCoreApplication: (QCoreApplication *)qCoreApplication
OF_DESIGNATED_INITIALIZER; OF_DESIGNATED_INITIALIZER;
- (void)installNativeEventFilter: (QAbstractNativeEventFilter *)filterObject; - (void)installNativeEventFilter: (QAbstractNativeEventFilter *)filterObject;
- (void)quit; - (void)quit;
@ -55,7 +55,7 @@ toOF(QCoreApplication *qCoreApplication)
static OF_INLINE QCoreApplication * static OF_INLINE QCoreApplication *
toQt(QtCoreApplication *coreApplication) toQt(QtCoreApplication *coreApplication)
{ {
return [coreApplication qCoreApplication]; return coreApplication.qCoreApplication;
} }
} }

View file

@ -28,12 +28,12 @@ using ObjQt::toOF;
using ObjQt::toQt; using ObjQt::toQt;
@implementation QtCoreApplication @implementation QtCoreApplication
- initWithQObject: (QObject *)qObject - (instancetype)initWithQObject: (QObject *)qObject
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQCoreApplication: (QCoreApplication *)qCoreApplication - (instancetype)initWithQCoreApplication: (QCoreApplication *)qCoreApplication
{ {
return [super initWithQObject: qCoreApplication]; return [super initWithQObject: qCoreApplication];
} }

View file

@ -38,8 +38,8 @@
@property (readonly, nonatomic) QEvent::Type type; @property (readonly, nonatomic) QEvent::Type type;
+ (int)registerEventType: (int)hint; + (int)registerEventType: (int)hint;
- init OF_UNAVAILABLE; - (instancetype)init OF_UNAVAILABLE;
- initWithQEvent: (QEvent *)qEvent OF_DESIGNATED_INITIALIZER; - (instancetype)initWithQEvent: (QEvent *)qEvent OF_DESIGNATED_INITIALIZER;
- (void)accept; - (void)accept;
- (void)ignore; - (void)ignore;
@end @end
@ -58,7 +58,7 @@ toOF(QEvent *qEvent)
static OF_INLINE QEvent * static OF_INLINE QEvent *
toQt(QtEvent *event) toQt(QtEvent *event)
{ {
return [event qEvent]; return event.qEvent;
} }
} }

View file

@ -30,12 +30,12 @@
return QEvent::registerEventType(hint); return QEvent::registerEventType(hint);
} }
- init - (instancetype)init
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQEvent: (QEvent *)qEvent - (instancetype)initWithQEvent: (QEvent *)qEvent
{ {
self = [super init]; self = [super init];

View file

@ -44,8 +44,8 @@
OFArray OF_GENERIC(OFData *) *dynamicPropertyNames; OFArray OF_GENERIC(OFData *) *dynamicPropertyNames;
@property (readonly, nonatomic) QtThread *thread; @property (readonly, nonatomic) QtThread *thread;
- init OF_UNAVAILABLE; - (instancetype)init OF_UNAVAILABLE;
- initWithQObject: (QObject *)qObject OF_DESIGNATED_INITIALIZER; - (instancetype)initWithQObject: (QObject *)qObject OF_DESIGNATED_INITIALIZER;
- (bool)setBlockSignals: (bool)block; - (bool)setBlockSignals: (bool)block;
- (QMetaObject::Connection)connectSignal: (OFString *)signal - (QMetaObject::Connection)connectSignal: (OFString *)signal
sender: (QtObject *)sender sender: (QtObject *)sender
@ -97,7 +97,7 @@ toOF(QObject *qObject)
static OF_INLINE QObject * static OF_INLINE QObject *
toQt(QtObject *object) toQt(QtObject *object)
{ {
return [object qObject]; return object.qObject;
} }
} }

View file

@ -34,12 +34,12 @@ using ObjQt::toQt;
@implementation QtObject @implementation QtObject
@synthesize qObject = _qObject; @synthesize qObject = _qObject;
- init - (instancetype)init
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQObject: (QObject *)qObject - (instancetype)initWithQObject: (QObject *)qObject
{ {
self = [super init]; self = [super init];
@ -106,21 +106,21 @@ using ObjQt::toQt;
type: (Qt::ConnectionType)type type: (Qt::ConnectionType)type
{ {
return _qObject->connect(toQt(sender), return _qObject->connect(toQt(sender),
[signal UTF8String], [method UTF8String], type); signal.UTF8String, method.UTF8String, type);
} }
- (bool)disconnectSignal: (OFString *)signal - (bool)disconnectSignal: (OFString *)signal
receiver: (QtObject *)receiver receiver: (QtObject *)receiver
method: (OFString *)method method: (OFString *)method
{ {
return _qObject->disconnect([signal UTF8String], toQt(receiver), return _qObject->disconnect(signal.UTF8String, toQt(receiver),
[method UTF8String]); method.UTF8String);
} }
- (bool)disconnectAllSignalsForReceiver: (QtObject *)receiver - (bool)disconnectAllSignalsForReceiver: (QtObject *)receiver
method: (OFString *)method method: (OFString *)method
{ {
return _qObject->disconnect(toQt(receiver), [method UTF8String]); return _qObject->disconnect(toQt(receiver), method.UTF8String);
} }
- (void)dumpObjectInfo - (void)dumpObjectInfo
@ -164,7 +164,7 @@ using ObjQt::toQt;
- (bool)inheritsClassWithName: (OFString *)className - (bool)inheritsClassWithName: (OFString *)className
{ {
return _qObject->inherits([className UTF8String]); return _qObject->inherits(className.UTF8String);
} }
- (void)installEventFilter: (QtObject *)filterObj - (void)installEventFilter: (QtObject *)filterObj
@ -209,7 +209,7 @@ using ObjQt::toQt;
- (QVariant)propertyForName: (OFString *)name - (QVariant)propertyForName: (OFString *)name
{ {
return _qObject->property([name UTF8String]); return _qObject->property(name.UTF8String);
} }
- (void)removeEventFilter: (QtObject *)obj - (void)removeEventFilter: (QtObject *)obj
@ -220,7 +220,7 @@ using ObjQt::toQt;
- (bool)setProperty: (QVariant &)value - (bool)setProperty: (QVariant &)value
forName: (OFString *)name forName: (OFString *)name
{ {
return _qObject->setProperty([name UTF8String], value); return _qObject->setProperty(name.UTF8String, value);
} }
- (bool)signalsBlocked - (bool)signalsBlocked

View file

@ -35,8 +35,8 @@
@property (nonatomic) QThread::Priority priority; @property (nonatomic) QThread::Priority priority;
@property (nonatomic) unsigned int stackSize; @property (nonatomic) unsigned int stackSize;
- initWithQObject: (QObject *)qObject OF_UNAVAILABLE; - (instancetype)initWithQObject: (QObject *)qObject OF_UNAVAILABLE;
- initWithQThread: (QThread *)qThread OF_DESIGNATED_INITIALIZER; - (instancetype)initWithQThread: (QThread *)qThread OF_DESIGNATED_INITIALIZER;
- (void)exitWithReturnCode: (int)returnCode; - (void)exitWithReturnCode: (int)returnCode;
- (void)requestInterruption; - (void)requestInterruption;
- (bool)waitForMilliseconds: (unsigned long)time; - (bool)waitForMilliseconds: (unsigned long)time;
@ -59,7 +59,7 @@ toOF(QThread *qThread)
static OF_INLINE QThread * static OF_INLINE QThread *
toQt(QtThread *thread) toQt(QtThread *thread)
{ {
return [thread qThread]; return thread.qThread;
} }
} }

View file

@ -25,12 +25,12 @@
using ObjQt::toQt; using ObjQt::toQt;
@implementation QtThread: QtObject @implementation QtThread: QtObject
- initWithQObject: (QObject *)qObject - (instancetype)initWithQObject: (QObject *)qObject
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQThread: (QThread *)qThread - (instancetype)initWithQThread: (QThread *)qThread
{ {
return [super initWithQObject: qThread]; return [super initWithQObject: qThread];
} }

View file

@ -38,8 +38,9 @@
@property (readonly, nonatomic) OFString *sessionID; @property (readonly, nonatomic) OFString *sessionID;
@property (readonly, nonatomic) OFString *sessionKey; @property (readonly, nonatomic) OFString *sessionKey;
- initWithQCoreApplication: (QCoreApplication *)qCoreApplication OF_UNAVAILABLE; - (instancetype)initWithQCoreApplication: (QCoreApplication *)qCoreApplication
- initWithQGuiApplication: (QGuiApplication *)qGuiApplication OF_UNAVAILABLE;
- (instancetype)initWithQGuiApplication: (QGuiApplication *)qGuiApplication
OF_DESIGNATED_INITIALIZER; OF_DESIGNATED_INITIALIZER;
- (double)devicePixelRatio; - (double)devicePixelRatio;
- (bool)isSavingSession; - (bool)isSavingSession;
@ -61,7 +62,7 @@ toOF(QGuiApplication *qGuiApplication)
static OF_INLINE QGuiApplication * static OF_INLINE QGuiApplication *
toQt(QtGUIApplication *GUIApplication) toQt(QtGUIApplication *GUIApplication)
{ {
return [GUIApplication qGuiApplication]; return GUIApplication.qGuiApplication;
} }
} }

View file

@ -29,12 +29,12 @@ using ObjQt::toOF;
using ObjQt::toQt; using ObjQt::toQt;
@implementation QtGUIApplication @implementation QtGUIApplication
- initWithQCoreApplication: (QCoreApplication *)qCoreApplication - (instancetype)initWithQCoreApplication: (QCoreApplication *)qCoreApplication
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQGuiApplication: (QGuiApplication *)qGuiApplication - (instancetype)initWithQGuiApplication: (QGuiApplication *)qGuiApplication
{ {
return [super initWithQCoreApplication: qGuiApplication]; return [super initWithQCoreApplication: qGuiApplication];
} }

View file

@ -53,7 +53,7 @@ namespace ObjQt {
static OF_INLINE QPaintDevice * static OF_INLINE QPaintDevice *
toQt(id <QtPaintDevice> paintDevice) toQt(id <QtPaintDevice> paintDevice)
{ {
return [paintDevice qPaintDevice]; return paintDevice.qPaintDevice;
} }
} }

View file

@ -31,7 +31,7 @@ using ObjQt::toQt;
- (QPaintDevice *)qPaintDevice - (QPaintDevice *)qPaintDevice
{ {
return dynamic_cast<QPaintDevice *>([self qObject]); return dynamic_cast<QPaintDevice *>(self.qObject);
} }
- (int)colorCount - (int)colorCount

View file

@ -39,8 +39,8 @@
@property (nonatomic, copy) OFString *text; @property (nonatomic, copy) OFString *text;
@property (readonly, nonatomic) QButtonGroup *group; @property (readonly, nonatomic) QButtonGroup *group;
- initWithQWidget: (QWidget *)qWidget OF_UNAVAILABLE; - (instancetype)initWithQWidget: (QWidget *)qWidget OF_UNAVAILABLE;
- initWithQAbstractButton: (QAbstractButton *)qAbstractButton - (instancetype)initWithQAbstractButton: (QAbstractButton *)qAbstractButton
OF_DESIGNATED_INITIALIZER; OF_DESIGNATED_INITIALIZER;
@end @end
@ -59,7 +59,7 @@ toOF(QAbstractButton *qAbstractButton)
static OF_INLINE QAbstractButton * static OF_INLINE QAbstractButton *
toQt(QtAbstractButton *abstractButton) toQt(QtAbstractButton *abstractButton)
{ {
return [abstractButton qAbstractButton]; return abstractButton.qAbstractButton;
} }
} }

View file

@ -29,12 +29,12 @@ using ObjQt::toOF;
using ObjQt::toQt; using ObjQt::toQt;
@implementation QtAbstractButton @implementation QtAbstractButton
- initWithQWidget: (QWidget *)qWidget - (instancetype)initWithQWidget: (QWidget *)qWidget
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQAbstractButton: (QAbstractButton *)qAbstractButton - (instancetype)initWithQAbstractButton: (QAbstractButton *)qAbstractButton
{ {
return [super initWithQWidget: qAbstractButton]; return [super initWithQWidget: qAbstractButton];
} }

View file

@ -47,11 +47,11 @@
@property (copy, nonatomic) OFString *whatsThis; @property (copy, nonatomic) OFString *whatsThis;
@property (readonly, nonatomic) @property (readonly, nonatomic)
OFArray OF_GENERIC(QtWidget *) *associatedWidgets; OFArray OF_GENERIC(QtWidget *) *associatedWidgets;
@property (nonatomic, setter=setSeparator:) bool isSeparator; @property (nonatomic, setter=setSeparator:) bool isSeparator;
@property (readonly, nonatomic) QtWidget *parentWidget; @property (readonly, nonatomic) QtWidget *parentWidget;
- initWithQObject: (QObject *)qObject OF_UNAVAILABLE; - (instancetype)initWithQObject: (QObject *)qObject OF_UNAVAILABLE;
- initWithQAction: (QAction *)qAction OF_DESIGNATED_INITIALIZER; - (instancetype)initWithQAction: (QAction *)qAction OF_DESIGNATED_INITIALIZER;
- (QActionGroup *)actionGroup; - (QActionGroup *)actionGroup;
- (void)activate: (QAction::ActionEvent)event; - (void)activate: (QAction::ActionEvent)event;
- (QList<QGraphicsWidget *>)associatedGraphicsWidgets; - (QList<QGraphicsWidget *>)associatedGraphicsWidgets;
@ -79,7 +79,7 @@ toOF(QAction *qAction)
static OF_INLINE QAction * static OF_INLINE QAction *
toQt(QtAction *action) toQt(QtAction *action)
{ {
return [action qAction]; return action.qAction;
} }
} }

View file

@ -28,12 +28,12 @@ using ObjQt::toOF;
using ObjQt::toQt; using ObjQt::toQt;
@implementation QtAction @implementation QtAction
- initWithQObject: (QObject *)qObject - (instancetype)initWithQObject: (QObject *)qObject
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQAction: (QAction *)qAction - (instancetype)initWithQAction: (QAction *)qAction
{ {
return [super initWithQObject: qAction]; return [super initWithQObject: qAction];
} }

View file

@ -36,8 +36,10 @@
@property (nonatomic, copy) OFString *styleSheet; @property (nonatomic, copy) OFString *styleSheet;
@property (nonatomic) int wheelScrollLines; @property (nonatomic) int wheelScrollLines;
- initWithQGuiApplication: (QGuiApplication *)qGuiApplication OF_UNAVAILABLE; - (instancetype)initWithQGuiApplication: (QGuiApplication *)qGuiApplication
- initWithQApplication: (QApplication *)qApplication OF_DESIGNATED_INITIALIZER; OF_UNAVAILABLE;
- (instancetype)initWithQApplication: (QApplication *)qApplication
OF_DESIGNATED_INITIALIZER;
- (void)aboutQt; - (void)aboutQt;
- (void)closeAllWindows; - (void)closeAllWindows;
@end @end
@ -57,7 +59,7 @@ toOF(QApplication *qApplication)
static OF_INLINE QApplication * static OF_INLINE QApplication *
toQt(QtApplication *application) toQt(QtApplication *application)
{ {
return [application qApplication]; return application.qApplication;
} }
} }

View file

@ -29,12 +29,12 @@ using ObjQt::toOF;
using ObjQt::toQt; using ObjQt::toQt;
@implementation QtApplication @implementation QtApplication
- initWithQGuiApplication: (QGuiApplication *)qGuiApplication - (instancetype)initWithQGuiApplication: (QGuiApplication *)qGuiApplication
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQApplication: (QApplication *)qApplication - (instancetype)initWithQApplication: (QApplication *)qApplication
{ {
return [super initWithQGuiApplication: qApplication]; return [super initWithQGuiApplication: qApplication];
} }

View file

@ -52,8 +52,8 @@
@property (readonly, nonatomic) of_rectangle_t windowFrameGeometry; @property (readonly, nonatomic) of_rectangle_t windowFrameGeometry;
@property (readonly, nonatomic) of_rectangle_t windowFrameRect; @property (readonly, nonatomic) of_rectangle_t windowFrameRect;
- initWithQObject: (QObject *)qObject OF_UNAVAILABLE; - (instancetype)initWithQObject: (QObject *)qObject OF_UNAVAILABLE;
- initWithQGraphicsWidget: (QGraphicsWidget *)qGraphicsWidget - (instancetype)initWithQGraphicsWidget: (QGraphicsWidget *)qGraphicsWidget
OF_DESIGNATED_INITIALIZER; OF_DESIGNATED_INITIALIZER;
- (void)addAction: (QtAction *)action; - (void)addAction: (QtAction *)action;
- (void)addActions: (OFArray OF_GENERIC(QtAction *) *)actions; - (void)addActions: (OFArray OF_GENERIC(QtAction *) *)actions;
@ -107,7 +107,7 @@ toOF(QGraphicsWidget *qGraphicsWidget)
static OF_INLINE QGraphicsWidget * static OF_INLINE QGraphicsWidget *
toQt(QtGraphicsWidget *graphicsWidget) toQt(QtGraphicsWidget *graphicsWidget)
{ {
return [graphicsWidget qGraphicsWidget]; return graphicsWidget.qGraphicsWidget;
} }
} }

View file

@ -33,19 +33,19 @@ using ObjQt::toQt;
@implementation QtGraphicsWidget @implementation QtGraphicsWidget
- initWithQObject: (QObject *)qObject - (instancetype)initWithQObject: (QObject *)qObject
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQGraphicsWidget: (QGraphicsWidget *)qGraphicsWidget - (instancetype)initWithQGraphicsWidget: (QGraphicsWidget *)qGraphicsWidget
{ {
return [super initWithQObject: qGraphicsWidget]; return [super initWithQObject: qGraphicsWidget];
} }
- (QGraphicsWidget *)qGraphicsWidget - (QGraphicsWidget *)qGraphicsWidget
{ {
return dynamic_cast<QGraphicsWidget *>([self qObject]); return dynamic_cast<QGraphicsWidget *>(self.qObject);
} }
- (bool)autoFillBackground - (bool)autoFillBackground

View file

@ -33,11 +33,13 @@
@property (nonatomic, getter=isDefault, setter=setDefault:) bool default_; @property (nonatomic, getter=isDefault, setter=setDefault:) bool default_;
@property (nonatomic, getter=isFlat) bool flat; @property (nonatomic, getter=isFlat) bool flat;
- initWithQAbstractButton: (QAbstractButton *)qAbstractButton OF_UNAVAILABLE; - (instancetype)initWithQAbstractButton: (QAbstractButton *)qAbstractButton
- initWithQPushButton: (QPushButton *)qPushButton OF_DESIGNATED_INITIALIZER; OF_UNAVAILABLE;
- initWithText: (OFString *)text; - (instancetype)initWithQPushButton: (QPushButton *)qPushButton
- initWithIcon: (QIcon)icon OF_DESIGNATED_INITIALIZER;
text: (OFString *)text; - (instancetype)initWithText: (OFString *)text;
- (instancetype)initWithIcon: (QIcon)icon
text: (OFString *)text;
@end @end
namespace ObjQt { namespace ObjQt {
@ -55,7 +57,7 @@ toOF(QPushButton *qPushButton)
static OF_INLINE QPushButton * static OF_INLINE QPushButton *
toQt(QtPushButton *pushButton) toQt(QtPushButton *pushButton)
{ {
return [pushButton qPushButton]; return pushButton.qPushButton;
} }
} }

View file

@ -30,17 +30,17 @@ using ObjQt::toOF;
using ObjQt::toQt; using ObjQt::toQt;
@implementation QtPushButton @implementation QtPushButton
- initWithQAbstractButton: (QAbstractButton *)qAbstractButton - (instancetype)initWithQAbstractButton: (QAbstractButton *)qAbstractButton
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQPushButton: (QPushButton *)qPushButton - (instancetype)initWithQPushButton: (QPushButton *)qPushButton
{ {
return [super initWithQAbstractButton: qPushButton]; return [super initWithQAbstractButton: qPushButton];
} }
- initWithText: (OFString *)text - (instancetype)initWithText: (OFString *)text
{ {
try { try {
self = [self initWithQPushButton: self = [self initWithQPushButton:
@ -56,8 +56,8 @@ using ObjQt::toQt;
} }
} }
- initWithIcon: (QIcon)icon - (instancetype)initWithIcon: (QIcon)icon
text: (OFString *)text text: (OFString *)text
{ {
try { try {
self = [self initWithQPushButton: self = [self initWithQPushButton:

View file

@ -98,8 +98,8 @@
@property (readonly, nonatomic) QtWidget *window; @property (readonly, nonatomic) QtWidget *window;
@property (readonly, nonatomic) OFString *windowRole; @property (readonly, nonatomic) OFString *windowRole;
- initWithQObject: (QObject *)qObject OF_UNAVAILABLE; - (instancetype)initWithQObject: (QObject *)qObject OF_UNAVAILABLE;
- initWithQWidget: (QWidget *)qWidget OF_DESIGNATED_INITIALIZER; - (instancetype)initWithQWidget: (QWidget *)qWidget OF_DESIGNATED_INITIALIZER;
- (void)activateWindow; - (void)activateWindow;
- (void)addAction: (QtAction *)action; - (void)addAction: (QtAction *)action;
- (void)addActions: (OFArray OF_GENERIC(QtAction *) *)actions; - (void)addActions: (OFArray OF_GENERIC(QtAction *) *)actions;
@ -238,7 +238,7 @@ toOF(QWidget *qWidget)
static OF_INLINE QWidget * static OF_INLINE QWidget *
toQt(QtWidget *widget) toQt(QtWidget *widget)
{ {
return [widget qWidget]; return widget.qWidget;
} }
} }

View file

@ -40,12 +40,12 @@ using ObjQt::toQt;
[self inheritMethodsFromClass: [QtPaintDevice class]]; [self inheritMethodsFromClass: [QtPaintDevice class]];
} }
- initWithQObject: (QObject *)qObject - (instancetype)initWithQObject: (QObject *)qObject
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- initWithQWidget: (QWidget *)qWidget - (instancetype)initWithQWidget: (QWidget *)qWidget
{ {
return [super initWithQObject: qWidget]; return [super initWithQObject: qWidget];
} }

View file

@ -25,9 +25,10 @@
#include <QColor> #include <QColor>
@interface OFColor (QColor) @interface OFColor (QColor)
@property (readonly, nonatomic) QColor qColor;
+ (instancetype)colorWithQColor: (const QColor &)qColor; + (instancetype)colorWithQColor: (const QColor &)qColor;
- (instancetype)initWithQColor: (const QColor &)qColor; - (instancetype)initWithQColor: (const QColor &)qColor;
- (QColor)qColor;
@end @end
namespace ObjQt { namespace ObjQt {
@ -47,7 +48,7 @@ toQt(OFColor *color)
if (color == nil) if (color == nil)
return QColor(); return QColor();
return [color qColor]; return color.qColor;
} }
} }

View file

@ -25,9 +25,10 @@
#include <QByteArray> #include <QByteArray>
@interface OFData (QByteArray) @interface OFData (QByteArray)
@property (readonly, nonatomic) QByteArray qByteArray;
+ (instancetype)dataWithQByteArray: (const QByteArray &)qByteArray; + (instancetype)dataWithQByteArray: (const QByteArray &)qByteArray;
- (instancetype)initWithQByteArray: (const QByteArray &)qByteArray; - (instancetype)initWithQByteArray: (const QByteArray &)qByteArray;
- (QByteArray)qByteArray;
@end @end
namespace ObjQt { namespace ObjQt {
@ -47,7 +48,7 @@ toQt(OFData *data)
if (data == nil) if (data == nil)
return QByteArray(); return QByteArray();
return [data qByteArray]; return data.qByteArray;
} }
} }

View file

@ -36,7 +36,6 @@
- (QByteArray)qByteArray - (QByteArray)qByteArray
{ {
return QByteArray((const char *)[self items], return QByteArray((const char *)self.items, self.count * self.itemSize);
[self count] * [self itemSize]);
} }
@end @end

View file

@ -25,9 +25,10 @@
#include <QString> #include <QString>
@interface OFString (QString) @interface OFString (QString)
@property (readonly, nonatomic) QString qString;
+ (instancetype)stringWithQString: (const QString &)qString; + (instancetype)stringWithQString: (const QString &)qString;
- (instancetype)initWithQString: (const QString &)qString; - (instancetype)initWithQString: (const QString &)qString;
- (QString)qString;
@end @end
namespace ObjQt { namespace ObjQt {
@ -47,7 +48,7 @@ toQt(OFString *string)
if (string == nil) if (string == nil)
return QString(); return QString();
return [string qString]; return string.qString;
} }
} }

View file

@ -43,7 +43,7 @@
"char16_t and QChar have a different size!"); "char16_t and QChar have a different size!");
void *pool = objc_autoreleasePoolPush(); void *pool = objc_autoreleasePoolPush();
QString ret = QString((QChar *)[self UTF16String]); QString ret = QString((QChar *)self.UTF16String);
objc_autoreleasePoolPop(pool); objc_autoreleasePoolPop(pool);