Make toOF/toQt more powerful and complete QtWidget
This commit is contained in:
parent
b37c5f6fc5
commit
d8f3aa90ec
24 changed files with 1047 additions and 385 deletions
46
ObjQt.pro
46
ObjQt.pro
|
@ -9,30 +9,32 @@ INCLUDEPATH += common \
|
||||||
QtGui \
|
QtGui \
|
||||||
QtWidgets
|
QtWidgets
|
||||||
|
|
||||||
HEADERS += common/helpers.h \
|
HEADERS += common/helpers.h \
|
||||||
common/OFString+QString.h \
|
common/OFDataArray+QByteArray.h \
|
||||||
common/QtOwnershipManaging.h \
|
common/OFString+QString.h \
|
||||||
QtCore/QtChildEvent.h \
|
common/QtOwnershipManaging.h \
|
||||||
QtCore/QtCoreApplication.h \
|
QtCore/QtChildEvent.h \
|
||||||
QtCore/QtEvent.h \
|
QtCore/QtCoreApplication.h \
|
||||||
QtCore/QtObject.h \
|
QtCore/QtEvent.h \
|
||||||
QtCore/QtThread.h \
|
QtCore/QtObject.h \
|
||||||
QtGui/QtGuiApplication.h \
|
QtCore/QtThread.h \
|
||||||
QtGui/QtPaintDevice.h \
|
QtGui/QtGUIApplication.h \
|
||||||
QtWidgets/QtAction.h \
|
QtGui/QtPaintDevice.h \
|
||||||
QtWidgets/QtApplication.h \
|
QtWidgets/QtAction.h \
|
||||||
|
QtWidgets/QtApplication.h \
|
||||||
QtWidgets/QtWidget.h
|
QtWidgets/QtWidget.h
|
||||||
|
|
||||||
SOURCES += common/OFString+QString.mm \
|
SOURCES += common/OFDataArray+QByteArray.mm \
|
||||||
QtCore/QtChildEvent.mm \
|
common/OFString+QString.mm \
|
||||||
QtCore/QtCoreApplication.mm \
|
QtCore/QtChildEvent.mm \
|
||||||
QtCore/QtEvent.mm \
|
QtCore/QtCoreApplication.mm \
|
||||||
QtCore/QtObject.mm \
|
QtCore/QtEvent.mm \
|
||||||
QtCore/QtThread.mm \
|
QtCore/QtObject.mm \
|
||||||
QtGui/QtGuiApplication.mm \
|
QtCore/QtThread.mm \
|
||||||
QtGui/QtPaintDevice.mm \
|
QtGui/QtGUIApplication.mm \
|
||||||
QtWidgets/QtAction.mm \
|
QtGui/QtPaintDevice.mm \
|
||||||
QtWidgets/QtApplication.mm \
|
QtWidgets/QtAction.mm \
|
||||||
|
QtWidgets/QtApplication.mm \
|
||||||
QtWidgets/QtWidget.mm
|
QtWidgets/QtWidget.mm
|
||||||
|
|
||||||
OBJCFLAGS += $$system("objfw-config --cppflags --objcflags --cxxflags")
|
OBJCFLAGS += $$system("objfw-config --cppflags --objcflags --cxxflags")
|
||||||
|
|
|
@ -35,3 +35,20 @@
|
||||||
- initWithType: (QChildEvent::Type)type
|
- initWithType: (QChildEvent::Type)type
|
||||||
child: (QtObject*)child;
|
child: (QtObject*)child;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtChildEvent*
|
||||||
|
toOF(QChildEvent *qChildEvent)
|
||||||
|
{
|
||||||
|
return [[[QtChildEvent alloc]
|
||||||
|
initWithQChildEvent: qChildEvent] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QChildEvent*
|
||||||
|
toQt(QtChildEvent *childEvent)
|
||||||
|
{
|
||||||
|
return [childEvent qChildEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
#import "QtChildEvent.h"
|
#import "QtChildEvent.h"
|
||||||
#import "QtObject.h"
|
#import "QtObject.h"
|
||||||
|
|
||||||
|
using ObjQt::toOF;
|
||||||
|
using ObjQt::toQt;
|
||||||
|
|
||||||
@implementation QtChildEvent
|
@implementation QtChildEvent
|
||||||
- initWithQEvent: (QEvent*)event
|
- initWithQEvent: (QEvent*)event
|
||||||
{
|
{
|
||||||
|
@ -39,7 +42,7 @@
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
self = [self initWithQChildEvent:
|
self = [self initWithQChildEvent:
|
||||||
new QChildEvent(type, [child qObject])];
|
new QChildEvent(type, toQt(child))];
|
||||||
|
|
||||||
[self takeOwnership];
|
[self takeOwnership];
|
||||||
|
|
||||||
|
@ -58,22 +61,21 @@
|
||||||
|
|
||||||
- (bool)isAdded
|
- (bool)isAdded
|
||||||
{
|
{
|
||||||
return [self qChildEvent]->added();
|
return toQt(self)->added();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QtObject*)child
|
- (QtObject*)child
|
||||||
{
|
{
|
||||||
return [[[QtObject alloc]
|
return toOF(toQt(self)->child());
|
||||||
initWithQObject: [self qChildEvent]->child()] autorelease];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isPolished
|
- (bool)isPolished
|
||||||
{
|
{
|
||||||
return [self qChildEvent]->polished();
|
return toQt(self)->polished();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isRemoved
|
- (bool)isRemoved
|
||||||
{
|
{
|
||||||
return [self qChildEvent]->removed();
|
return toQt(self)->removed();
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -37,3 +37,20 @@
|
||||||
- (bool)sendEvent: (QtEvent*)event
|
- (bool)sendEvent: (QtEvent*)event
|
||||||
receiver: (QtObject*)receiver;
|
receiver: (QtObject*)receiver;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtCoreApplication*
|
||||||
|
toOF(QCoreApplication *qCoreApplication)
|
||||||
|
{
|
||||||
|
return [[[QtCoreApplication alloc]
|
||||||
|
initWithQCoreApplication: qCoreApplication] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QCoreApplication*
|
||||||
|
toQt(QtCoreApplication *coreApplication)
|
||||||
|
{
|
||||||
|
return [coreApplication qCoreApplication];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -22,8 +22,10 @@
|
||||||
|
|
||||||
#import "QtCoreApplication.h"
|
#import "QtCoreApplication.h"
|
||||||
#import "QtEvent.h"
|
#import "QtEvent.h"
|
||||||
|
#import "OFString+QString.h"
|
||||||
|
|
||||||
#import "helpers.h"
|
using ObjQt::toOF;
|
||||||
|
using ObjQt::toQt;
|
||||||
|
|
||||||
@implementation QtCoreApplication
|
@implementation QtCoreApplication
|
||||||
- initWithQObject: (QObject*)qObject
|
- initWithQObject: (QObject*)qObject
|
||||||
|
@ -43,75 +45,72 @@
|
||||||
|
|
||||||
- (OFString*)applicationName
|
- (OFString*)applicationName
|
||||||
{
|
{
|
||||||
return toOF([self qCoreApplication]->applicationName());
|
return toOF(toQt(self)->applicationName());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setApplicationName: (OFString*)applicationName
|
- (void)setApplicationName: (OFString*)applicationName
|
||||||
{
|
{
|
||||||
[self qCoreApplication]->setApplicationName(toQt(applicationName));
|
toQt(self)->setApplicationName(toQt(applicationName));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)applicationVersion
|
- (OFString*)applicationVersion
|
||||||
{
|
{
|
||||||
return toOF([self qCoreApplication]->applicationVersion());
|
return toOF(toQt(self)->applicationVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)installNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
|
- (void)installNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
|
||||||
{
|
{
|
||||||
[self qCoreApplication]->installNativeEventFilter(filterObject);
|
toQt(self)->installNativeEventFilter(filterObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setApplicationVersion: (OFString*)applicationVersion
|
- (void)setApplicationVersion: (OFString*)applicationVersion
|
||||||
{
|
{
|
||||||
[self qCoreApplication]->setApplicationVersion(
|
toQt(self)->setApplicationVersion(toQt(applicationVersion));
|
||||||
toQt(applicationVersion));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)organizationDomain
|
- (OFString*)organizationDomain
|
||||||
{
|
{
|
||||||
return toOF([self qCoreApplication]->organizationDomain());
|
return toOF(toQt(self)->organizationDomain());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setOrganizationDomain: (OFString*)organizationDomain
|
- (void)setOrganizationDomain: (OFString*)organizationDomain
|
||||||
{
|
{
|
||||||
[self qCoreApplication]->setOrganizationDomain(
|
toQt(self)->setOrganizationDomain(toQt(organizationDomain));
|
||||||
toQt(organizationDomain));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)organizationName
|
- (OFString*)organizationName
|
||||||
{
|
{
|
||||||
return toOF([self qCoreApplication]->organizationName());
|
return toOF(toQt(self)->organizationName());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setOrganizationName: (OFString*)organizationName
|
- (void)setOrganizationName: (OFString*)organizationName
|
||||||
{
|
{
|
||||||
[self qCoreApplication]->setOrganizationName(toQt(organizationName));
|
toQt(self)->setOrganizationName(toQt(organizationName));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)quit
|
- (void)quit
|
||||||
{
|
{
|
||||||
[self qCoreApplication]->quit();
|
toQt(self)->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isQuitLockEnabled
|
- (bool)isQuitLockEnabled
|
||||||
{
|
{
|
||||||
return [self qCoreApplication]->isQuitLockEnabled();
|
return toQt(self)->isQuitLockEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setQuitLockEnabled: (bool)quitLockEnabled
|
- (void)setQuitLockEnabled: (bool)quitLockEnabled
|
||||||
{
|
{
|
||||||
[self qCoreApplication]->setQuitLockEnabled(quitLockEnabled);
|
toQt(self)->setQuitLockEnabled(quitLockEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)removeNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
|
- (void)removeNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
|
||||||
{
|
{
|
||||||
[self qCoreApplication]->removeNativeEventFilter(filterObject);
|
toQt(self)->removeNativeEventFilter(filterObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)sendEvent: (QtEvent*)event
|
- (bool)sendEvent: (QtEvent*)event
|
||||||
receiver: (QtObject*)receiver
|
receiver: (QtObject*)receiver
|
||||||
{
|
{
|
||||||
return [self qCoreApplication]->notify(
|
return toQt(self)->notify(toQt(receiver), toQt(event));
|
||||||
[receiver qObject], [event qEvent]);
|
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -42,3 +42,19 @@
|
||||||
- (void)accept;
|
- (void)accept;
|
||||||
- (void)ignore;
|
- (void)ignore;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtEvent*
|
||||||
|
toOF(QEvent *qEvent)
|
||||||
|
{
|
||||||
|
return [[[QtEvent alloc] initWithQEvent: qEvent] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QEvent*
|
||||||
|
toQt(QtEvent *event)
|
||||||
|
{
|
||||||
|
return [event qEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -80,3 +80,19 @@
|
||||||
- (QtThread*)thread;
|
- (QtThread*)thread;
|
||||||
- (void)deleteLater;
|
- (void)deleteLater;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtObject*
|
||||||
|
toOF(QObject *qObject)
|
||||||
|
{
|
||||||
|
return [[[QtObject alloc] initWithQObject: qObject] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QObject*
|
||||||
|
toQt(QtObject *object)
|
||||||
|
{
|
||||||
|
return [object qObject];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -23,11 +23,14 @@
|
||||||
#import "QtObject.h"
|
#import "QtObject.h"
|
||||||
#import "QtEvent.h"
|
#import "QtEvent.h"
|
||||||
#import "QtThread.h"
|
#import "QtThread.h"
|
||||||
|
#import "OFString+QString.h"
|
||||||
#import "helpers.h"
|
#import "OFDataArray+QByteArray.h"
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
|
using ObjQt::toOF;
|
||||||
|
using ObjQt::toQt;
|
||||||
|
|
||||||
@implementation QtObject
|
@implementation QtObject
|
||||||
@synthesize qObject = _qObject;
|
@synthesize qObject = _qObject;
|
||||||
|
|
||||||
|
@ -88,8 +91,7 @@
|
||||||
void *pool = objc_autoreleasePoolPush();
|
void *pool = objc_autoreleasePoolPush();
|
||||||
|
|
||||||
for (QObject *qChild: qChildren)
|
for (QObject *qChild: qChildren)
|
||||||
[children addObject:
|
[children addObject: toOF(qChild)];
|
||||||
[[[QtObject alloc] initWithQObject: qChild] autorelease]];
|
|
||||||
|
|
||||||
[children makeImmutable];
|
[children makeImmutable];
|
||||||
|
|
||||||
|
@ -103,7 +105,7 @@
|
||||||
method: (OFString*)method
|
method: (OFString*)method
|
||||||
type: (Qt::ConnectionType)type
|
type: (Qt::ConnectionType)type
|
||||||
{
|
{
|
||||||
return _qObject->connect([sender qObject],
|
return _qObject->connect(toQt(sender),
|
||||||
[signal UTF8String], [method UTF8String], type);
|
[signal UTF8String], [method UTF8String], type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,14 +113,14 @@
|
||||||
receiver: (QtObject*)receiver
|
receiver: (QtObject*)receiver
|
||||||
method: (OFString*)method
|
method: (OFString*)method
|
||||||
{
|
{
|
||||||
return _qObject->disconnect([signal UTF8String], [receiver qObject],
|
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([receiver qObject], [method UTF8String]);
|
return _qObject->disconnect(toQt(receiver), [method UTF8String]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dumpObjectInfo
|
- (void)dumpObjectInfo
|
||||||
|
@ -133,35 +135,31 @@
|
||||||
|
|
||||||
- (OFArray OF_GENERIC(OFDataArray*)*)dynamicPropertyNames
|
- (OFArray OF_GENERIC(OFDataArray*)*)dynamicPropertyNames
|
||||||
{
|
{
|
||||||
const QList<QByteArray> &qDynamicPropertyNames =
|
const QList<QByteArray> &dynamicPropertyNames =
|
||||||
_qObject->dynamicPropertyNames();
|
_qObject->dynamicPropertyNames();
|
||||||
OFMutableArray *dynamicPropertyNames =
|
OFMutableArray *ret =
|
||||||
[OFMutableArray arrayWithCapacity: qDynamicPropertyNames.count()];
|
[OFMutableArray arrayWithCapacity: dynamicPropertyNames.count()];
|
||||||
void *pool = objc_autoreleasePoolPush();
|
void *pool = objc_autoreleasePoolPush();
|
||||||
|
|
||||||
for (const QByteArray &qDynamicPropertyName: qDynamicPropertyNames) {
|
for (const QByteArray &dynamicPropertyName: dynamicPropertyNames)
|
||||||
OFDataArray *dynamicPropertyName = [OFDataArray dataArray];
|
[ret addObject: toOF(dynamicPropertyName)];
|
||||||
[dynamicPropertyName addItems: qDynamicPropertyName.data()
|
|
||||||
count: qDynamicPropertyName.count()];
|
|
||||||
[dynamicPropertyNames addObject: dynamicPropertyName];
|
|
||||||
}
|
|
||||||
|
|
||||||
[dynamicPropertyNames makeImmutable];
|
[ret makeImmutable];
|
||||||
|
|
||||||
objc_autoreleasePoolPop(pool);
|
objc_autoreleasePoolPop(pool);
|
||||||
|
|
||||||
return dynamicPropertyNames;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)handleEvent: (QtEvent*)event
|
- (bool)handleEvent: (QtEvent*)event
|
||||||
{
|
{
|
||||||
return _qObject->event([event qEvent]);
|
return _qObject->event(toQt(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)filterEvent: (QtEvent*)event
|
- (bool)filterEvent: (QtEvent*)event
|
||||||
forObject: (QtObject*)watched
|
forObject: (QtObject*)watched
|
||||||
{
|
{
|
||||||
return _qObject->eventFilter([watched qObject], [event qEvent]);
|
return _qObject->eventFilter(toQt(watched), toQt(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)inheritsClassWithName: (OFString*)className
|
- (bool)inheritsClassWithName: (OFString*)className
|
||||||
|
@ -171,7 +169,7 @@
|
||||||
|
|
||||||
- (void)installEventFilter: (QtObject*)filterObj
|
- (void)installEventFilter: (QtObject*)filterObj
|
||||||
{
|
{
|
||||||
_qObject->installEventFilter([filterObj qObject]);
|
_qObject->installEventFilter(toQt(filterObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isWidgetType
|
- (bool)isWidgetType
|
||||||
|
@ -196,18 +194,17 @@
|
||||||
|
|
||||||
- (void)moveToThread: (QtThread*)targetThread
|
- (void)moveToThread: (QtThread*)targetThread
|
||||||
{
|
{
|
||||||
_qObject->moveToThread([targetThread qThread]);
|
_qObject->moveToThread(toQt(targetThread));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QtObject*)parent
|
- (QtObject*)parent
|
||||||
{
|
{
|
||||||
return [[[QtObject alloc]
|
return toOF(_qObject->parent());
|
||||||
initWithQObject: _qObject->parent()] autorelease];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setParent: (QtObject*)parent
|
- (void)setParent: (QtObject*)parent
|
||||||
{
|
{
|
||||||
_qObject->setParent([parent qObject]);
|
_qObject->setParent(toQt(parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QVariant)propertyForName: (OFString*)name
|
- (QVariant)propertyForName: (OFString*)name
|
||||||
|
@ -217,7 +214,7 @@
|
||||||
|
|
||||||
- (void)removeEventFilter: (QtObject*)obj
|
- (void)removeEventFilter: (QtObject*)obj
|
||||||
{
|
{
|
||||||
_qObject->removeEventFilter([obj qObject]);
|
_qObject->removeEventFilter(toQt(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)setProperty: (QVariant&)value
|
- (bool)setProperty: (QVariant&)value
|
||||||
|
@ -239,8 +236,7 @@
|
||||||
|
|
||||||
- (QtThread*)thread
|
- (QtThread*)thread
|
||||||
{
|
{
|
||||||
return [[[QtThread alloc]
|
return toOF(_qObject->thread());
|
||||||
initWithQThread: _qObject->thread()] autorelease];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)deleteLater
|
- (void)deleteLater
|
||||||
|
|
|
@ -42,3 +42,19 @@
|
||||||
- (void)startWithPriority: (QThread::Priority)priority;
|
- (void)startWithPriority: (QThread::Priority)priority;
|
||||||
- (void)terminate;
|
- (void)terminate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtThread*
|
||||||
|
toOF(QThread *qThread)
|
||||||
|
{
|
||||||
|
return [[[QtThread alloc] initWithQThread: qThread] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QThread*
|
||||||
|
toQt(QtThread *thread)
|
||||||
|
{
|
||||||
|
return [thread qThread];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#import "QtThread.h"
|
#import "QtThread.h"
|
||||||
|
|
||||||
|
using ObjQt::toQt;
|
||||||
|
|
||||||
@implementation QtThread: QtObject
|
@implementation QtThread: QtObject
|
||||||
- initWithQObject: (QObject*)qObject
|
- initWithQObject: (QObject*)qObject
|
||||||
{
|
{
|
||||||
|
@ -40,81 +42,81 @@
|
||||||
|
|
||||||
- (QAbstractEventDispatcher*)eventDispatcher
|
- (QAbstractEventDispatcher*)eventDispatcher
|
||||||
{
|
{
|
||||||
return [self qThread]->eventDispatcher();
|
return toQt(self)->eventDispatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setEventDispatcher: (QAbstractEventDispatcher*)eventDispatcher
|
- (void)setEventDispatcher: (QAbstractEventDispatcher*)eventDispatcher
|
||||||
{
|
{
|
||||||
[self qThread]->setEventDispatcher(eventDispatcher);
|
toQt(self)->setEventDispatcher(eventDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)exitWithReturnCode: (int)returnCode
|
- (void)exitWithReturnCode: (int)returnCode
|
||||||
{
|
{
|
||||||
[self qThread]->exit(returnCode);
|
toQt(self)->exit(returnCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isFinished
|
- (bool)isFinished
|
||||||
{
|
{
|
||||||
return [self qThread]->isFinished();
|
return toQt(self)->isFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isInterruptionRequested
|
- (bool)isInterruptionRequested
|
||||||
{
|
{
|
||||||
return [self qThread]->isInterruptionRequested();
|
return toQt(self)->isInterruptionRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isRunning
|
- (bool)isRunning
|
||||||
{
|
{
|
||||||
return [self qThread]->isRunning();
|
return toQt(self)->isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)loopLevel
|
- (int)loopLevel
|
||||||
{
|
{
|
||||||
return [self qThread]->loopLevel();
|
return toQt(self)->loopLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QThread::Priority)priority
|
- (QThread::Priority)priority
|
||||||
{
|
{
|
||||||
return [self qThread]->priority();
|
return toQt(self)->priority();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setPriority: (QThread::Priority)priority
|
- (void)setPriority: (QThread::Priority)priority
|
||||||
{
|
{
|
||||||
[self qThread]->setPriority(priority);
|
toQt(self)->setPriority(priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)requestInterruption
|
- (void)requestInterruption
|
||||||
{
|
{
|
||||||
[self qThread]->requestInterruption();
|
toQt(self)->requestInterruption();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (unsigned int)stackSize
|
- (unsigned int)stackSize
|
||||||
{
|
{
|
||||||
return [self qThread]->stackSize();
|
return toQt(self)->stackSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStackSize: (unsigned int)stackSize
|
- (void)setStackSize: (unsigned int)stackSize
|
||||||
{
|
{
|
||||||
[self qThread]->setStackSize(stackSize);
|
toQt(self)->setStackSize(stackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)waitForMilliseconds: (unsigned long)time
|
- (bool)waitForMilliseconds: (unsigned long)time
|
||||||
{
|
{
|
||||||
return [self qThread]->wait(time);
|
return toQt(self)->wait(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)quit
|
- (void)quit
|
||||||
{
|
{
|
||||||
[self qThread]->quit();
|
toQt(self)->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)startWithPriority: (QThread::Priority)priority
|
- (void)startWithPriority: (QThread::Priority)priority
|
||||||
{
|
{
|
||||||
[self qThread]->start(priority);
|
toQt(self)->start(priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)terminate
|
- (void)terminate
|
||||||
{
|
{
|
||||||
[self qThread]->terminate();
|
toQt(self)->terminate();
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -24,14 +24,14 @@
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
@interface QtGuiApplication: QtCoreApplication
|
@interface QtGUIApplication: QtCoreApplication
|
||||||
@property (readonly) QGuiApplication *qGuiApplication;
|
@property (readonly) QGuiApplication *qGuiApplication;
|
||||||
@property (copy) OFString *applicationDisplayName;
|
@property (copy) OFString *applicationDisplayName;
|
||||||
@property (copy) OFString *desktopFileName;
|
@property (copy) OFString *desktopFileName;
|
||||||
@property Qt::LayoutDirection layoutDirection;
|
@property Qt::LayoutDirection layoutDirection;
|
||||||
@property (readonly, copy) OFString *platformName;
|
@property (readonly, copy) OFString *platformName;
|
||||||
@property (readonly) QScreen *primaryScreen;
|
@property (readonly) QScreen *primaryScreen;
|
||||||
@property bool quitOnLastWindowClosed;
|
@property bool quitsOnLastWindowClosed;
|
||||||
@property QIcon windowIcon;
|
@property QIcon windowIcon;
|
||||||
|
|
||||||
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication;
|
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication;
|
||||||
|
@ -41,3 +41,20 @@
|
||||||
- (OFString*)sessionID;
|
- (OFString*)sessionID;
|
||||||
- (OFString*)sessionKey;
|
- (OFString*)sessionKey;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtGUIApplication*
|
||||||
|
toOF(QGuiApplication *qGuiApplication)
|
||||||
|
{
|
||||||
|
return [[[QtGUIApplication alloc]
|
||||||
|
initWithQGuiApplication: qGuiApplication] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QGuiApplication*
|
||||||
|
toQt(QtGUIApplication *GUIApplication)
|
||||||
|
{
|
||||||
|
return [GUIApplication qGuiApplication];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -20,13 +20,15 @@
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "QtGuiApplication.h"
|
#import "QtGUIApplication.h"
|
||||||
|
#import "OFString+QString.h"
|
||||||
#import "helpers.h"
|
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
@implementation QtGuiApplication
|
using ObjQt::toOF;
|
||||||
|
using ObjQt::toQt;
|
||||||
|
|
||||||
|
@implementation QtGUIApplication
|
||||||
- initWithQCoreApplication: (QCoreApplication*)qCoreApplication
|
- initWithQCoreApplication: (QCoreApplication*)qCoreApplication
|
||||||
{
|
{
|
||||||
OF_INVALID_INIT_METHOD
|
OF_INVALID_INIT_METHOD
|
||||||
|
@ -44,88 +46,86 @@
|
||||||
|
|
||||||
- (OFString*)applicationDisplayName
|
- (OFString*)applicationDisplayName
|
||||||
{
|
{
|
||||||
return toOF([self qGuiApplication]->applicationDisplayName());
|
return toOF(toQt(self)->applicationDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setApplicationDisplayName: (OFString*)applicationDisplayName
|
- (void)setApplicationDisplayName: (OFString*)applicationDisplayName
|
||||||
{
|
{
|
||||||
[self qGuiApplication]->setApplicationDisplayName(
|
toQt(self)->setApplicationDisplayName(toQt(applicationDisplayName));
|
||||||
toQt(applicationDisplayName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)desktopFileName
|
- (OFString*)desktopFileName
|
||||||
{
|
{
|
||||||
return toOF([self qGuiApplication]->desktopFileName());
|
return toOF(toQt(self)->desktopFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setDesktopFileName: (OFString*)desktopFileName
|
- (void)setDesktopFileName: (OFString*)desktopFileName
|
||||||
{
|
{
|
||||||
[self qGuiApplication]->setDesktopFileName(toQt(desktopFileName));
|
toQt(self)->setDesktopFileName(toQt(desktopFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (double)devicePixelRatio
|
- (double)devicePixelRatio
|
||||||
{
|
{
|
||||||
return [self qGuiApplication]->devicePixelRatio();
|
return toQt(self)->devicePixelRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isSavingSession
|
- (bool)isSavingSession
|
||||||
{
|
{
|
||||||
return [self qGuiApplication]->isSavingSession();
|
return toQt(self)->isSavingSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isSessionRestored
|
- (bool)isSessionRestored
|
||||||
{
|
{
|
||||||
return [self qGuiApplication]->isSessionRestored();
|
return toQt(self)->isSessionRestored();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (Qt::LayoutDirection)layoutDirection
|
- (Qt::LayoutDirection)layoutDirection
|
||||||
{
|
{
|
||||||
return [self qGuiApplication]->layoutDirection();
|
return toQt(self)->layoutDirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setLayoutDirection: (Qt::LayoutDirection)layoutDirection
|
- (void)setLayoutDirection: (Qt::LayoutDirection)layoutDirection
|
||||||
{
|
{
|
||||||
[self qGuiApplication]->setLayoutDirection(layoutDirection);
|
toQt(self)->setLayoutDirection(layoutDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)platformName
|
- (OFString*)platformName
|
||||||
{
|
{
|
||||||
return toOF([self qGuiApplication]->platformName());
|
return toOF(toQt(self)->platformName());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QScreen*)primaryScreen
|
- (QScreen*)primaryScreen
|
||||||
{
|
{
|
||||||
return [self qGuiApplication]->primaryScreen();
|
return toQt(self)->primaryScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)quitOnLastWindowClosed
|
- (bool)quitsOnLastWindowClosed
|
||||||
{
|
{
|
||||||
return [self qGuiApplication]->quitOnLastWindowClosed();
|
return toQt(self)->quitOnLastWindowClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setQuitOnLastWindowClosed: (bool)quitOnLastWindowClosed
|
- (void)setQuitsOnLastWindowClosed: (bool)quitsOnLastWindowClosed
|
||||||
{
|
{
|
||||||
[self qGuiApplication]->setQuitOnLastWindowClosed(
|
toQt(self)->setQuitOnLastWindowClosed(quitsOnLastWindowClosed);
|
||||||
quitOnLastWindowClosed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)sessionID
|
- (OFString*)sessionID
|
||||||
{
|
{
|
||||||
return toOF([self qGuiApplication]->sessionId());
|
return toOF(toQt(self)->sessionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)sessionKey
|
- (OFString*)sessionKey
|
||||||
{
|
{
|
||||||
return toOF([self qGuiApplication]->sessionKey());
|
return toOF(toQt(self)->sessionKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QIcon)windowIcon
|
- (QIcon)windowIcon
|
||||||
{
|
{
|
||||||
return [self qGuiApplication]->windowIcon();
|
return toQt(self)->windowIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setWindowIcon: (QIcon)windowIcon
|
- (void)setWindowIcon: (QIcon)windowIcon
|
||||||
{
|
{
|
||||||
[self qGuiApplication]->setWindowIcon(windowIcon);
|
toQt(self)->setWindowIcon(windowIcon);
|
||||||
}
|
}
|
||||||
@end
|
@end
|
|
@ -45,3 +45,13 @@
|
||||||
@interface QtPaintDevice: OFObject <QtPaintDevice>
|
@interface QtPaintDevice: OFObject <QtPaintDevice>
|
||||||
@property (readonly) QObject *qObject;
|
@property (readonly) QObject *qObject;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QPaintDevice*
|
||||||
|
toQt(QtPaintDevice *paintDevice)
|
||||||
|
{
|
||||||
|
return [paintDevice qPaintDevice];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
using ObjQt::toQt;
|
||||||
|
|
||||||
@implementation QtPaintDevice
|
@implementation QtPaintDevice
|
||||||
@dynamic qObject;
|
@dynamic qObject;
|
||||||
|
|
||||||
|
@ -34,71 +36,71 @@
|
||||||
|
|
||||||
- (int)colorCount
|
- (int)colorCount
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->colorCount();
|
return toQt(self)->colorCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)depth
|
- (int)depth
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->depth();
|
return toQt(self)->depth();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)devicePixelRatio
|
- (int)devicePixelRatio
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->devicePixelRatio();
|
return toQt(self)->devicePixelRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (double)devicePixelRatioF
|
- (double)devicePixelRatioF
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->devicePixelRatioF();
|
return toQt(self)->devicePixelRatioF();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)height
|
- (int)height
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->height();
|
return toQt(self)->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)heightMM
|
- (int)heightMM
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->heightMM();
|
return toQt(self)->heightMM();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)logicalDPIX
|
- (int)logicalDPIX
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->logicalDpiX();
|
return toQt(self)->logicalDpiX();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)logicalDPIY
|
- (int)logicalDPIY
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->logicalDpiY();
|
return toQt(self)->logicalDpiY();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QPaintEngine*)paintEngine
|
- (QPaintEngine*)paintEngine
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->paintEngine();
|
return toQt(self)->paintEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)paintingActive
|
- (bool)paintingActive
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->paintingActive();
|
return toQt(self)->paintingActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)physicalDPIX
|
- (int)physicalDPIX
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->physicalDpiX();
|
return toQt(self)->physicalDpiX();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)physicalDPIY
|
- (int)physicalDPIY
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->physicalDpiY();
|
return toQt(self)->physicalDpiY();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)width
|
- (int)width
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->width();
|
return toQt(self)->width();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)widthMM
|
- (int)widthMM
|
||||||
{
|
{
|
||||||
return [self qPaintDevice]->widthMM();
|
return toQt(self)->widthMM();
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
- (QMenu*)menu;
|
- (QMenu*)menu;
|
||||||
- (QtWidget*)parentWidget;
|
- (QtWidget*)parentWidget;
|
||||||
- (void)setActionGroup: (QActionGroup*)group;
|
- (void)setActionGroup: (QActionGroup*)group;
|
||||||
|
- (void)setData: (const QVariant&)data;
|
||||||
- (void)setMenu: (QMenu*)menu;
|
- (void)setMenu: (QMenu*)menu;
|
||||||
- (void)setSeparator: (bool)isSeparator;
|
- (void)setSeparator: (bool)isSeparator;
|
||||||
- (void)setShortcuts: (const QList<QKeySequence>&)shortcuts;
|
- (void)setShortcuts: (const QList<QKeySequence>&)shortcuts;
|
||||||
|
@ -63,3 +64,19 @@
|
||||||
- (QList<QKeySequence>)shortcuts;
|
- (QList<QKeySequence>)shortcuts;
|
||||||
- (bool)showStatusText: (QtWidget*)widget;
|
- (bool)showStatusText: (QtWidget*)widget;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtAction*
|
||||||
|
toOF(QAction *qAction)
|
||||||
|
{
|
||||||
|
return [[[QtAction alloc] initWithQAction: qAction] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QAction*
|
||||||
|
toQt(QtAction *action)
|
||||||
|
{
|
||||||
|
return [action qAction];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -22,8 +22,10 @@
|
||||||
|
|
||||||
#import "QtAction.h"
|
#import "QtAction.h"
|
||||||
#import "QtWidget.h"
|
#import "QtWidget.h"
|
||||||
|
#import "OFString+QString.h"
|
||||||
|
|
||||||
#import "helpers.h"
|
using ObjQt::toOF;
|
||||||
|
using ObjQt::toQt;
|
||||||
|
|
||||||
@implementation QtAction
|
@implementation QtAction
|
||||||
- initWithQObject: (QObject*)qObject
|
- initWithQObject: (QObject*)qObject
|
||||||
|
@ -43,199 +45,198 @@
|
||||||
|
|
||||||
- (bool)autoRepeat
|
- (bool)autoRepeat
|
||||||
{
|
{
|
||||||
return [self qAction]->autoRepeat();
|
return toQt(self)->autoRepeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setAutoRepeat: (bool)autoRepeat
|
- (void)setAutoRepeat: (bool)autoRepeat
|
||||||
{
|
{
|
||||||
[self qAction]->setAutoRepeat(autoRepeat);
|
toQt(self)->setAutoRepeat(autoRepeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isCheckable
|
- (bool)isCheckable
|
||||||
{
|
{
|
||||||
return [self qAction]->isCheckable();
|
return toQt(self)->isCheckable();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setCheckable: (bool)checkable
|
- (void)setCheckable: (bool)checkable
|
||||||
{
|
{
|
||||||
[self qAction]->setCheckable(checkable);
|
toQt(self)->setCheckable(checkable);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isChecked
|
- (bool)isChecked
|
||||||
{
|
{
|
||||||
return [self qAction]->isChecked();
|
return toQt(self)->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setChecked: (bool)checked
|
- (void)setChecked: (bool)checked
|
||||||
{
|
{
|
||||||
[self qAction]->setChecked(checked);
|
toQt(self)->setChecked(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isEnabled
|
- (bool)isEnabled
|
||||||
{
|
{
|
||||||
return [self qAction]->isEnabled();
|
return toQt(self)->isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setEnabled: (bool)enabled
|
- (void)setEnabled: (bool)enabled
|
||||||
{
|
{
|
||||||
[self qAction]->setEnabled(enabled);
|
toQt(self)->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QFont)font
|
- (QFont)font
|
||||||
{
|
{
|
||||||
return [self qAction]->font();
|
return toQt(self)->font();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFont: (QFont)font
|
- (void)setFont: (QFont)font
|
||||||
{
|
{
|
||||||
[self qAction]->setFont(font);
|
toQt(self)->setFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QIcon)icon
|
- (QIcon)icon
|
||||||
{
|
{
|
||||||
return [self qAction]->icon();
|
return toQt(self)->icon();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setIcon: (QIcon)icon
|
- (void)setIcon: (QIcon)icon
|
||||||
{
|
{
|
||||||
[self qAction]->setIcon(icon);
|
toQt(self)->setIcon(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)iconText
|
- (OFString*)iconText
|
||||||
{
|
{
|
||||||
return toOF([self qAction]->iconText());
|
return toOF(toQt(self)->iconText());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setIconText: (OFString*)iconText
|
- (void)setIconText: (OFString*)iconText
|
||||||
{
|
{
|
||||||
[self qAction]->setIconText(toQt(iconText));
|
toQt(self)->setIconText(toQt(iconText));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isIconVisibleInMenu
|
- (bool)isIconVisibleInMenu
|
||||||
{
|
{
|
||||||
return [self qAction]->isIconVisibleInMenu();
|
return toQt(self)->isIconVisibleInMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setIconVisibleInMenu: (bool)iconVisibleInMenu
|
- (void)setIconVisibleInMenu: (bool)iconVisibleInMenu
|
||||||
{
|
{
|
||||||
[self qAction]->setIconVisibleInMenu(iconVisibleInMenu);
|
toQt(self)->setIconVisibleInMenu(iconVisibleInMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QAction::MenuRole)menuRole
|
- (QAction::MenuRole)menuRole
|
||||||
{
|
{
|
||||||
return [self qAction]->menuRole();
|
return toQt(self)->menuRole();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setMenuRole: (QAction::MenuRole)menuRole
|
- (void)setMenuRole: (QAction::MenuRole)menuRole
|
||||||
{
|
{
|
||||||
[self qAction]->setMenuRole(menuRole);
|
toQt(self)->setMenuRole(menuRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QAction::Priority)priority
|
- (QAction::Priority)priority
|
||||||
{
|
{
|
||||||
return [self qAction]->priority();
|
return toQt(self)->priority();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setPriority: (QAction::Priority)priority
|
- (void)setPriority: (QAction::Priority)priority
|
||||||
{
|
{
|
||||||
[self qAction]->setPriority(priority);
|
toQt(self)->setPriority(priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QKeySequence)shortcut
|
- (QKeySequence)shortcut
|
||||||
{
|
{
|
||||||
return [self qAction]->shortcut();
|
return toQt(self)->shortcut();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setShortcut: (QKeySequence)shortcut
|
- (void)setShortcut: (QKeySequence)shortcut
|
||||||
{
|
{
|
||||||
[self qAction]->setShortcut(shortcut);
|
toQt(self)->setShortcut(shortcut);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (Qt::ShortcutContext)shortcutContext
|
- (Qt::ShortcutContext)shortcutContext
|
||||||
{
|
{
|
||||||
return [self qAction]->shortcutContext();
|
return toQt(self)->shortcutContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setShortcutContext: (Qt::ShortcutContext)shortcutContext
|
- (void)setShortcutContext: (Qt::ShortcutContext)shortcutContext
|
||||||
{
|
{
|
||||||
[self qAction]->setShortcutContext(shortcutContext);
|
toQt(self)->setShortcutContext(shortcutContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)statusTip
|
- (OFString*)statusTip
|
||||||
{
|
{
|
||||||
return toOF([self qAction]->statusTip());
|
return toOF(toQt(self)->statusTip());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStatusTip: (OFString*)statusTip
|
- (void)setStatusTip: (OFString*)statusTip
|
||||||
{
|
{
|
||||||
[self qAction]->setStatusTip(toQt(statusTip));
|
toQt(self)->setStatusTip(toQt(statusTip));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)text
|
- (OFString*)text
|
||||||
{
|
{
|
||||||
return toOF([self qAction]->text());
|
return toOF(toQt(self)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setText: (OFString*)text
|
- (void)setText: (OFString*)text
|
||||||
{
|
{
|
||||||
[self qAction]->setText(toQt(text));
|
toQt(self)->setText(toQt(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)toolTip
|
- (OFString*)toolTip
|
||||||
{
|
{
|
||||||
return toOF([self qAction]->toolTip());
|
return toOF(toQt(self)->toolTip());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setToolTip: (OFString*)toolTip
|
- (void)setToolTip: (OFString*)toolTip
|
||||||
{
|
{
|
||||||
[self qAction]->setToolTip(toQt(toolTip));
|
toQt(self)->setToolTip(toQt(toolTip));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isVisible
|
- (bool)isVisible
|
||||||
{
|
{
|
||||||
return [self qAction]->isVisible();
|
return toQt(self)->isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setVisible: (bool)visible
|
- (void)setVisible: (bool)visible
|
||||||
{
|
{
|
||||||
[self qAction]->setVisible(visible);
|
toQt(self)->setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)whatsThis
|
- (OFString*)whatsThis
|
||||||
{
|
{
|
||||||
return toOF([self qAction]->whatsThis());
|
return toOF(toQt(self)->whatsThis());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setWhatsThis: (OFString*)whatsThis
|
- (void)setWhatsThis: (OFString*)whatsThis
|
||||||
{
|
{
|
||||||
[self qAction]->setWhatsThis(toQt(whatsThis));
|
toQt(self)->setWhatsThis(toQt(whatsThis));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QActionGroup*)actionGroup
|
- (QActionGroup*)actionGroup
|
||||||
{
|
{
|
||||||
return [self qAction]->actionGroup();
|
return toQt(self)->actionGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)activate: (QAction::ActionEvent)event
|
- (void)activate: (QAction::ActionEvent)event
|
||||||
{
|
{
|
||||||
[self qAction]->activate(event);
|
toQt(self)->activate(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QList<QGraphicsWidget*>)associatedGraphicsWidgets
|
- (QList<QGraphicsWidget*>)associatedGraphicsWidgets
|
||||||
{
|
{
|
||||||
return [self qAction]->associatedGraphicsWidgets();
|
return toQt(self)->associatedGraphicsWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFArray OF_GENERIC(QtWidget*)*)associatedWidgets
|
- (OFArray OF_GENERIC(QtWidget*)*)associatedWidgets
|
||||||
{
|
{
|
||||||
const QList<QWidget*> &widgets = [self qAction]->associatedWidgets();
|
const QList<QWidget*> &widgets = toQt(self)->associatedWidgets();
|
||||||
OFMutableArray *ret =
|
OFMutableArray *ret =
|
||||||
[OFMutableArray arrayWithCapacity: widgets.count()];
|
[OFMutableArray arrayWithCapacity: widgets.count()];
|
||||||
void *pool = objc_autoreleasePoolPush();
|
void *pool = objc_autoreleasePoolPush();
|
||||||
|
|
||||||
for (QWidget *widget: widgets)
|
for (QWidget *widget: widgets)
|
||||||
[ret addObject:
|
[ret addObject: toOF(widget)];
|
||||||
[[[QtWidget alloc] initWithQWidget: widget] autorelease]];
|
|
||||||
|
|
||||||
[ret makeImmutable];
|
[ret makeImmutable];
|
||||||
|
|
||||||
|
@ -246,57 +247,61 @@
|
||||||
|
|
||||||
- (QVariant)data
|
- (QVariant)data
|
||||||
{
|
{
|
||||||
return [self qAction]->data();
|
return toQt(self)->data();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)isSeparator
|
- (bool)isSeparator
|
||||||
{
|
{
|
||||||
return [self qAction]->isSeparator();
|
return toQt(self)->isSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QMenu*)menu
|
- (QMenu*)menu
|
||||||
{
|
{
|
||||||
return [self qAction]->menu();
|
return toQt(self)->menu();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QtWidget*)parentWidget
|
- (QtWidget*)parentWidget
|
||||||
{
|
{
|
||||||
return [[[QtWidget alloc] initWithQWidget:
|
return toOF(toQt(self)->parentWidget());
|
||||||
[self qAction]->parentWidget()] autorelease];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActionGroup: (QActionGroup*)group
|
- (void)setActionGroup: (QActionGroup*)group
|
||||||
{
|
{
|
||||||
[self qAction]->setActionGroup(group);
|
toQt(self)->setActionGroup(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setData: (const QVariant&)userData
|
||||||
|
{
|
||||||
|
toQt(self)->setData(userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setMenu: (QMenu*)menu
|
- (void)setMenu: (QMenu*)menu
|
||||||
{
|
{
|
||||||
[self qAction]->setMenu(menu);
|
toQt(self)->setMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setSeparator: (bool)isSeparator
|
- (void)setSeparator: (bool)isSeparator
|
||||||
{
|
{
|
||||||
[self qAction]->setSeparator(isSeparator);
|
toQt(self)->setSeparator(isSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setShortcuts: (const QList<QKeySequence>&)shortcuts
|
- (void)setShortcuts: (const QList<QKeySequence>&)shortcuts
|
||||||
{
|
{
|
||||||
[self qAction]->setShortcuts(shortcuts);
|
toQt(self)->setShortcuts(shortcuts);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setShortcutsWithStandardKey: (QKeySequence::StandardKey)key
|
- (void)setShortcutsWithStandardKey: (QKeySequence::StandardKey)key
|
||||||
{
|
{
|
||||||
[self qAction]->setShortcuts(key);
|
toQt(self)->setShortcuts(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QList<QKeySequence>)shortcuts
|
- (QList<QKeySequence>)shortcuts
|
||||||
{
|
{
|
||||||
return [self qAction]->shortcuts();
|
return toQt(self)->shortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)showStatusText: (QtWidget*)widget
|
- (bool)showStatusText: (QtWidget*)widget
|
||||||
{
|
{
|
||||||
return [self qAction]->showStatusText([widget qWidget]);
|
return toQt(self)->showStatusText(toQt(widget));
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "QtGuiApplication.h"
|
#import "QtGUIApplication.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
@interface QtApplication: QtGuiApplication
|
@interface QtApplication: QtGUIApplication
|
||||||
@property (readonly) QApplication *qApplication;
|
@property (readonly) QApplication *qApplication;
|
||||||
@property bool autoSipEnabled;
|
@property bool autoSIPEnabled;
|
||||||
@property int cursorFlashTime;
|
@property int cursorFlashTime;
|
||||||
@property int doubleClickInterval;
|
@property int doubleClickInterval;
|
||||||
@property of_dimension_t globalStrut;
|
@property of_dimension_t globalStrut;
|
||||||
|
@ -38,7 +38,22 @@
|
||||||
|
|
||||||
- initWithQApplication: (QApplication*)qApplication;
|
- initWithQApplication: (QApplication*)qApplication;
|
||||||
- (void)aboutQt;
|
- (void)aboutQt;
|
||||||
- (bool)autoSipEnabled;
|
|
||||||
- (void)closeAllWindows;
|
- (void)closeAllWindows;
|
||||||
- (void)setAutoSipEnabled: (bool)enabled;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtApplication*
|
||||||
|
toOF(QApplication *qApplication)
|
||||||
|
{
|
||||||
|
return [[[QtApplication alloc]
|
||||||
|
initWithQApplication: qApplication] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QApplication*
|
||||||
|
toQt(QtApplication *application)
|
||||||
|
{
|
||||||
|
return [application qApplication];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -21,9 +21,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "QtApplication.h"
|
#import "QtApplication.h"
|
||||||
|
#import "OFString+QString.h"
|
||||||
|
|
||||||
#import "helpers.h"
|
#import "helpers.h"
|
||||||
|
|
||||||
|
using ObjQt::toOF;
|
||||||
|
using ObjQt::toQt;
|
||||||
|
|
||||||
@implementation QtApplication
|
@implementation QtApplication
|
||||||
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication
|
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication
|
||||||
{
|
{
|
||||||
|
@ -40,103 +44,103 @@
|
||||||
return qobject_cast<QApplication*>(_qObject);
|
return qobject_cast<QApplication*>(_qObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)autoSipEnabled
|
- (bool)autoSIPEnabled
|
||||||
{
|
{
|
||||||
return [self qApplication]->autoSipEnabled();
|
return toQt(self)->autoSipEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setAutoSipEnabled: (bool)autoSipEnabled
|
- (void)setAutoSIPEnabled: (bool)autoSIPEnabled
|
||||||
{
|
{
|
||||||
[self qApplication]->setAutoSipEnabled(autoSipEnabled);
|
toQt(self)->setAutoSipEnabled(autoSIPEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)cursorFlashTime
|
- (int)cursorFlashTime
|
||||||
{
|
{
|
||||||
return [self qApplication]->cursorFlashTime();
|
return toQt(self)->cursorFlashTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setCursorFlashTime: (int)cursorFlashTime
|
- (void)setCursorFlashTime: (int)cursorFlashTime
|
||||||
{
|
{
|
||||||
[self qApplication]->setCursorFlashTime(cursorFlashTime);
|
toQt(self)->setCursorFlashTime(cursorFlashTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)doubleClickInterval
|
- (int)doubleClickInterval
|
||||||
{
|
{
|
||||||
return [self qApplication]->doubleClickInterval();
|
return toQt(self)->doubleClickInterval();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setDoubleClickInterval: (int)doubleClickInterval
|
- (void)setDoubleClickInterval: (int)doubleClickInterval
|
||||||
{
|
{
|
||||||
[self qApplication]->setDoubleClickInterval(doubleClickInterval);
|
toQt(self)->setDoubleClickInterval(doubleClickInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (of_dimension_t)globalStrut
|
- (of_dimension_t)globalStrut
|
||||||
{
|
{
|
||||||
return toOF([self qApplication]->globalStrut());
|
return toOF(toQt(self)->globalStrut());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setGlobalStrut: (of_dimension_t)globalStrut
|
- (void)setGlobalStrut: (of_dimension_t)globalStrut
|
||||||
{
|
{
|
||||||
[self qApplication]->setGlobalStrut(toQt(globalStrut));
|
toQt(self)->setGlobalStrut(toQt(globalStrut));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)keyboardInputInterval
|
- (int)keyboardInputInterval
|
||||||
{
|
{
|
||||||
return [self qApplication]->keyboardInputInterval();
|
return toQt(self)->keyboardInputInterval();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setKeyboardInputInterval: (int)keyboardInputInterval
|
- (void)setKeyboardInputInterval: (int)keyboardInputInterval
|
||||||
{
|
{
|
||||||
[self qApplication]->setKeyboardInputInterval(keyboardInputInterval);
|
toQt(self)->setKeyboardInputInterval(keyboardInputInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)startDragDistance
|
- (int)startDragDistance
|
||||||
{
|
{
|
||||||
return [self qApplication]->startDragDistance();
|
return toQt(self)->startDragDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStartDragDistance: (int)startDragDistance
|
- (void)setStartDragDistance: (int)startDragDistance
|
||||||
{
|
{
|
||||||
[self qApplication]->setStartDragDistance(startDragDistance);
|
toQt(self)->setStartDragDistance(startDragDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)startDragTime
|
- (int)startDragTime
|
||||||
{
|
{
|
||||||
return [self qApplication]->startDragTime();
|
return toQt(self)->startDragTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStartDragTime: (int)startDragTime
|
- (void)setStartDragTime: (int)startDragTime
|
||||||
{
|
{
|
||||||
[self qApplication]->setStartDragTime(startDragTime);
|
toQt(self)->setStartDragTime(startDragTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OFString*)styleSheet
|
- (OFString*)styleSheet
|
||||||
{
|
{
|
||||||
return toOF([self qApplication]->styleSheet());
|
return toOF(toQt(self)->styleSheet());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStyleSheet: (OFString*)styleSheet
|
- (void)setStyleSheet: (OFString*)styleSheet
|
||||||
{
|
{
|
||||||
[self qApplication]->setStyleSheet(toQt(styleSheet));
|
toQt(self)->setStyleSheet(toQt(styleSheet));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)wheelScrollLines
|
- (int)wheelScrollLines
|
||||||
{
|
{
|
||||||
return [self qApplication]->wheelScrollLines();
|
return toQt(self)->wheelScrollLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setWheelScrollLines: (int)wheelScrollLines
|
- (void)setWheelScrollLines: (int)wheelScrollLines
|
||||||
{
|
{
|
||||||
[self qApplication]->setWheelScrollLines(wheelScrollLines);
|
toQt(self)->setWheelScrollLines(wheelScrollLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)aboutQt
|
- (void)aboutQt
|
||||||
{
|
{
|
||||||
[self qApplication]->aboutQt();
|
toQt(self)->aboutQt();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)closeAllWindows
|
- (void)closeAllWindows
|
||||||
{
|
{
|
||||||
[self qApplication]->closeAllWindows();
|
toQt(self)->closeAllWindows();
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
@property Qt::ContextMenuPolicy contextMenuPolicy;
|
@property Qt::ContextMenuPolicy contextMenuPolicy;
|
||||||
@property QCursor cursor;
|
@property QCursor cursor;
|
||||||
@property (getter=isEnabled) bool enabled;
|
@property (getter=isEnabled) bool enabled;
|
||||||
@property (readonly, getter=hasFocus) bool focus;
|
|
||||||
@property Qt::FocusPolicy focusPolicy;
|
@property Qt::FocusPolicy focusPolicy;
|
||||||
@property const QFont &font;
|
@property const QFont &font;
|
||||||
@property (readonly) of_rectangle_t frameGeometry;
|
@property (readonly) of_rectangle_t frameGeometry;
|
||||||
|
@ -78,7 +77,6 @@
|
||||||
@property (getter=isVisible) bool visible;
|
@property (getter=isVisible) bool visible;
|
||||||
@property (copy) OFString *whatsThis;
|
@property (copy) OFString *whatsThis;
|
||||||
@property (readonly) int width;
|
@property (readonly) int width;
|
||||||
@property (copy) OFString *windowFilePath;
|
|
||||||
@property Qt::WindowFlags windowFlags;
|
@property Qt::WindowFlags windowFlags;
|
||||||
@property QIcon windowIcon;
|
@property QIcon windowIcon;
|
||||||
@property Qt::WindowModality windowModality;
|
@property Qt::WindowModality windowModality;
|
||||||
|
@ -101,7 +99,7 @@
|
||||||
- (void)clearMask;
|
- (void)clearMask;
|
||||||
- (QMargins)contentsMargins;
|
- (QMargins)contentsMargins;
|
||||||
- (of_rectangle_t)contentsRect;
|
- (of_rectangle_t)contentsRect;
|
||||||
- (WId)effectiveWinId;
|
- (WId)effectiveWinID;
|
||||||
- (void)ensurePolished;
|
- (void)ensurePolished;
|
||||||
- (QtWidget*)focusProxy;
|
- (QtWidget*)focusProxy;
|
||||||
- (QtWidget*)focusWidget;
|
- (QtWidget*)focusWidget;
|
||||||
|
@ -123,6 +121,7 @@
|
||||||
#ifdef QT_KEYPAD_NAVIGATION
|
#ifdef QT_KEYPAD_NAVIGATION
|
||||||
- (bool)hasEditFocus;
|
- (bool)hasEditFocus;
|
||||||
#endif
|
#endif
|
||||||
|
- (bool)hasFocus;
|
||||||
- (bool)hasHeightForWidth;
|
- (bool)hasHeightForWidth;
|
||||||
- (int)heightForWidth: (int)w;
|
- (int)heightForWidth: (int)w;
|
||||||
- (QVariant)queryInputMethod: (Qt::InputMethodQuery)query;
|
- (QVariant)queryInputMethod: (Qt::InputMethodQuery)query;
|
||||||
|
@ -135,19 +134,107 @@
|
||||||
- (bool)isHidden;
|
- (bool)isHidden;
|
||||||
- (bool)isVisibleTo: (QtWidget*)ancestor;
|
- (bool)isVisibleTo: (QtWidget*)ancestor;
|
||||||
- (bool)isWindow;
|
- (bool)isWindow;
|
||||||
// QPoint mapFrom(const QWidget *parent, const QPoint &pos) const
|
- (of_point_t)mapPosition: (of_point_t)pos
|
||||||
// QPoint mapFromGlobal(const QPoint &pos) const
|
from: (QtWidget*)parent;
|
||||||
// QPoint mapFromParent(const QPoint &pos) const
|
- (of_point_t)mapPositionFromGlobal: (of_point_t)pos;
|
||||||
// QPoint mapTo(const QWidget *parent, const QPoint &pos) const
|
- (of_point_t)mapPositionFromParent: (of_point_t)pos;
|
||||||
// QPoint mapToGlobal(const QPoint &pos) const
|
- (of_point_t)mapPosition: (of_point_t)pos
|
||||||
// QPoint mapToParent(const QPoint &pos) const
|
to: (QtWidget*)parent;
|
||||||
// QRegion mask() const
|
- (of_point_t)mapPositionToGlobal: (of_point_t)pos;
|
||||||
// ...
|
- (of_point_t)mapPositionToParent: (of_point_t)pos;
|
||||||
|
- (QRegion)mask;
|
||||||
|
- (QtWidget*)nativeParentWidget;
|
||||||
|
- (QtWidget*)nextInFocusChain;
|
||||||
|
- (void)overrideWindowFlags: (Qt::WindowFlags)flags;
|
||||||
|
- (QtWidget*)parentWidget;
|
||||||
|
- (QtWidget*)previousInFocusChain;
|
||||||
|
- (void)releaseKeyboard;
|
||||||
|
- (void)releaseMouse;
|
||||||
|
- (void)releaseShortcut: (int)ID;
|
||||||
|
- (void)removeAction: (QtAction*)action;
|
||||||
|
- (void)renderIntoPaintDevice: (QtObject <QtPaintDevice>*)target
|
||||||
|
targetOffset: (of_point_t)targetOffset
|
||||||
|
sourceRegion: (QRegion)sourceRegion;
|
||||||
|
- (void)renderIntoPaintDevice: (QtObject <QtPaintDevice>*)target
|
||||||
|
targetOffset: (of_point_t)targetOffset
|
||||||
|
sourceRegion: (QRegion)sourceRegion
|
||||||
|
flags: (QWidget::RenderFlags)renderFlags;
|
||||||
|
- (void)renderIntoPainter: (QPainter*)target
|
||||||
|
targetOffset: (of_point_t)targetOffset
|
||||||
|
sourceRegion: (QRegion)sourceRegion;
|
||||||
|
- (void)renderIntoPainter: (QPainter*)target
|
||||||
|
targetOffset: (of_point_t)targetOffset
|
||||||
|
sourceRegion: (QRegion)sourceRegion
|
||||||
|
flags: (QWidget::RenderFlags)renderFlags;
|
||||||
|
- (void)repaintInRectangle: (of_rectangle_t)rect;
|
||||||
|
- (void)repaintInRegion: (const QRegion&)region;
|
||||||
|
- (bool)restoreGeometry: (OFDataArray*)geometry;
|
||||||
|
- (OFDataArray*)saveGeometry;
|
||||||
|
- (void)scrollRight: (int)dx
|
||||||
|
down: (int)dy;
|
||||||
|
- (void)scrollRight: (int)dx
|
||||||
|
down: (int)dy
|
||||||
|
inRectangle: (of_rectangle_t)rect;
|
||||||
|
- (void)setAttribute: (Qt::WidgetAttribute)attribute
|
||||||
|
to: (bool)on;
|
||||||
|
#ifdef QT_KEYPAD_NAVIGATION
|
||||||
|
- (void)setEditFocus: (bool)enable;
|
||||||
|
#endif
|
||||||
|
- (void)setFixedHeight: (int)height;
|
||||||
|
- (void)setFixedSize: (of_dimension_t)size;
|
||||||
|
- (void)setFixedWidth: (int)width;
|
||||||
|
- (void)setFocus: (Qt::FocusReason)reason;
|
||||||
|
- (void)setFocusProxy: (QtWidget*)widget;
|
||||||
|
- (void)setForegroundRole: (QPalette::ColorRole)role;
|
||||||
|
- (void)setGraphicsEffect: (QGraphicsEffect*)effect;
|
||||||
|
- (void)setLayout: (QLayout*)layout;
|
||||||
|
- (void)setMaskFromBitmap: (const QBitmap&)bitmap;
|
||||||
|
- (void)setMask: (const QRegion&)region;
|
||||||
|
- (void)setParent: (QtWidget*)parent;
|
||||||
|
- (void)setParent: (QtWidget*)parent
|
||||||
|
flags: (Qt::WindowFlags)flags;
|
||||||
|
- (void)setAutoRepeat: (bool)enable
|
||||||
|
forShortcut: (int)ID;
|
||||||
|
- (void)setEnabled: (bool)enable
|
||||||
|
forShortcut: (int)ID;
|
||||||
|
- (void)setStyle: (QStyle*)style;
|
||||||
|
- (void)setWindowRole: (OFString*)role;
|
||||||
|
- (void)setWindowState: (Qt::WindowStates)windowState;
|
||||||
|
- (void)stackUnder: (QtWidget*)widget;
|
||||||
|
- (QStyle*)style;
|
||||||
|
- (bool)testAttribute: (Qt::WidgetAttribute)attribute;
|
||||||
|
- (bool)isUnderMouse;
|
||||||
|
- (void)ungrabGesture: (Qt::GestureType)gesture;
|
||||||
- (void)unsetCursor;
|
- (void)unsetCursor;
|
||||||
- (void)unsetLayoutDirection;
|
- (void)unsetLayoutDirection;
|
||||||
- (void)unsetLocale;
|
- (void)unsetLocale;
|
||||||
|
- (void)updateInRectangle: (of_rectangle_t)rect;
|
||||||
|
- (void)updateInRegion: (const QRegion&)region;
|
||||||
|
- (void)updateGeometry;
|
||||||
|
- (QRegion)visibleRegion;
|
||||||
|
- (WId)winID;
|
||||||
|
- (QtWidget*)window;
|
||||||
|
- (QWindow*)windowHandle;
|
||||||
|
- (OFString*)windowRole;
|
||||||
|
- (Qt::WindowStates)windowState;
|
||||||
|
- (Qt::WindowType)windowType;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QtWidget (QtPaintDevice) <QtPaintDevice>
|
@interface QtWidget (QtPaintDevice) <QtPaintDevice>
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE QtWidget*
|
||||||
|
toOF(QWidget *qWidget)
|
||||||
|
{
|
||||||
|
return [[[QtWidget alloc] initWithQWidget: qWidget] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QWidget*
|
||||||
|
toQt(QtWidget *widget)
|
||||||
|
{
|
||||||
|
return [widget qWidget];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
46
common/OFDataArray+QByteArray.h
Normal file
46
common/OFDataArray+QByteArray.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
|
*
|
||||||
|
* https://heap.zone/git/objqt.git
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice is present in all copies.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <ObjFW/ObjFW.h>
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
@interface OFDataArray (QByteArray)
|
||||||
|
+ (instancetype)dataArrayWithQByteArray: (const QByteArray&)qByteArray;
|
||||||
|
- (QByteArray)qByteArray;
|
||||||
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE OFDataArray*
|
||||||
|
toOF(const QByteArray &qByteArray)
|
||||||
|
{
|
||||||
|
return [OFDataArray dataArrayWithQByteArray: qByteArray];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QByteArray
|
||||||
|
toQt(OFDataArray *dataArray)
|
||||||
|
{
|
||||||
|
return [dataArray qByteArray];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
39
common/OFDataArray+QByteArray.mm
Normal file
39
common/OFDataArray+QByteArray.mm
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
|
*
|
||||||
|
* https://heap.zone/git/objqt.git
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice is present in all copies.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "OFDataArray+QByteArray.h"
|
||||||
|
|
||||||
|
@implementation OFDataArray (QByteArray)
|
||||||
|
+ (instancetype)dataArrayWithQByteArray: (const QByteArray&)qByteArray
|
||||||
|
{
|
||||||
|
OFDataArray *ret = [OFDataArray dataArray];
|
||||||
|
[ret addItems: qByteArray.data()
|
||||||
|
count: qByteArray.count()];
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (QByteArray)qByteArray
|
||||||
|
{
|
||||||
|
return QByteArray((char*)[self items], [self count] * [self itemSize]);
|
||||||
|
}
|
||||||
|
@end
|
|
@ -29,3 +29,19 @@
|
||||||
- initWithQString: (const QString&)qString;
|
- initWithQString: (const QString&)qString;
|
||||||
- (QString)qString;
|
- (QString)qString;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
namespace ObjQt {
|
||||||
|
|
||||||
|
static OF_INLINE OFString*
|
||||||
|
toOF(const QString &qString)
|
||||||
|
{
|
||||||
|
return [OFString stringWithQString: qString];
|
||||||
|
}
|
||||||
|
|
||||||
|
static OF_INLINE QString
|
||||||
|
toQt(OFString *string)
|
||||||
|
{
|
||||||
|
return [string qString];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -22,23 +22,17 @@
|
||||||
|
|
||||||
#import <ObjFW/ObjFW.h>
|
#import <ObjFW/ObjFW.h>
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
#import "OFString+QString.h"
|
#import "QtObject.h"
|
||||||
|
#import "QtAction.h"
|
||||||
|
#import "QtEvent.h"
|
||||||
|
#import "QtChildEvent.h"
|
||||||
|
#import "QtThread.h"
|
||||||
|
#import "QtWidget.h"
|
||||||
|
|
||||||
static OF_INLINE OFString*
|
namespace ObjQt {
|
||||||
toOF(const QString &qString)
|
|
||||||
{
|
|
||||||
return [OFString stringWithQString: qString];
|
|
||||||
}
|
|
||||||
|
|
||||||
static OF_INLINE QString
|
|
||||||
toQt(OFString *string)
|
|
||||||
{
|
|
||||||
return [string qString];
|
|
||||||
}
|
|
||||||
|
|
||||||
static OF_INLINE of_point_t
|
static OF_INLINE of_point_t
|
||||||
toOF(const QPoint &qPoint)
|
toOF(const QPoint &qPoint)
|
||||||
|
@ -77,3 +71,5 @@ toQt(of_rectangle_t rectangle)
|
||||||
return QRect(rectangle.origin.x, rectangle.origin.y,
|
return QRect(rectangle.origin.x, rectangle.origin.y,
|
||||||
rectangle.size.width, rectangle.size.height);
|
rectangle.size.width, rectangle.size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue