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 \
|
||||
QtWidgets
|
||||
|
||||
HEADERS += common/helpers.h \
|
||||
common/OFString+QString.h \
|
||||
common/QtOwnershipManaging.h \
|
||||
QtCore/QtChildEvent.h \
|
||||
QtCore/QtCoreApplication.h \
|
||||
QtCore/QtEvent.h \
|
||||
QtCore/QtObject.h \
|
||||
QtCore/QtThread.h \
|
||||
QtGui/QtGuiApplication.h \
|
||||
QtGui/QtPaintDevice.h \
|
||||
QtWidgets/QtAction.h \
|
||||
QtWidgets/QtApplication.h \
|
||||
HEADERS += common/helpers.h \
|
||||
common/OFDataArray+QByteArray.h \
|
||||
common/OFString+QString.h \
|
||||
common/QtOwnershipManaging.h \
|
||||
QtCore/QtChildEvent.h \
|
||||
QtCore/QtCoreApplication.h \
|
||||
QtCore/QtEvent.h \
|
||||
QtCore/QtObject.h \
|
||||
QtCore/QtThread.h \
|
||||
QtGui/QtGUIApplication.h \
|
||||
QtGui/QtPaintDevice.h \
|
||||
QtWidgets/QtAction.h \
|
||||
QtWidgets/QtApplication.h \
|
||||
QtWidgets/QtWidget.h
|
||||
|
||||
SOURCES += common/OFString+QString.mm \
|
||||
QtCore/QtChildEvent.mm \
|
||||
QtCore/QtCoreApplication.mm \
|
||||
QtCore/QtEvent.mm \
|
||||
QtCore/QtObject.mm \
|
||||
QtCore/QtThread.mm \
|
||||
QtGui/QtGuiApplication.mm \
|
||||
QtGui/QtPaintDevice.mm \
|
||||
QtWidgets/QtAction.mm \
|
||||
QtWidgets/QtApplication.mm \
|
||||
SOURCES += common/OFDataArray+QByteArray.mm \
|
||||
common/OFString+QString.mm \
|
||||
QtCore/QtChildEvent.mm \
|
||||
QtCore/QtCoreApplication.mm \
|
||||
QtCore/QtEvent.mm \
|
||||
QtCore/QtObject.mm \
|
||||
QtCore/QtThread.mm \
|
||||
QtGui/QtGUIApplication.mm \
|
||||
QtGui/QtPaintDevice.mm \
|
||||
QtWidgets/QtAction.mm \
|
||||
QtWidgets/QtApplication.mm \
|
||||
QtWidgets/QtWidget.mm
|
||||
|
||||
OBJCFLAGS += $$system("objfw-config --cppflags --objcflags --cxxflags")
|
||||
|
|
|
@ -35,3 +35,20 @@
|
|||
- initWithType: (QChildEvent::Type)type
|
||||
child: (QtObject*)child;
|
||||
@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 "QtObject.h"
|
||||
|
||||
using ObjQt::toOF;
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtChildEvent
|
||||
- initWithQEvent: (QEvent*)event
|
||||
{
|
||||
|
@ -39,7 +42,7 @@
|
|||
{
|
||||
try {
|
||||
self = [self initWithQChildEvent:
|
||||
new QChildEvent(type, [child qObject])];
|
||||
new QChildEvent(type, toQt(child))];
|
||||
|
||||
[self takeOwnership];
|
||||
|
||||
|
@ -58,22 +61,21 @@
|
|||
|
||||
- (bool)isAdded
|
||||
{
|
||||
return [self qChildEvent]->added();
|
||||
return toQt(self)->added();
|
||||
}
|
||||
|
||||
- (QtObject*)child
|
||||
{
|
||||
return [[[QtObject alloc]
|
||||
initWithQObject: [self qChildEvent]->child()] autorelease];
|
||||
return toOF(toQt(self)->child());
|
||||
}
|
||||
|
||||
- (bool)isPolished
|
||||
{
|
||||
return [self qChildEvent]->polished();
|
||||
return toQt(self)->polished();
|
||||
}
|
||||
|
||||
- (bool)isRemoved
|
||||
{
|
||||
return [self qChildEvent]->removed();
|
||||
return toQt(self)->removed();
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -37,3 +37,20 @@
|
|||
- (bool)sendEvent: (QtEvent*)event
|
||||
receiver: (QtObject*)receiver;
|
||||
@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 "QtEvent.h"
|
||||
#import "OFString+QString.h"
|
||||
|
||||
#import "helpers.h"
|
||||
using ObjQt::toOF;
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtCoreApplication
|
||||
- initWithQObject: (QObject*)qObject
|
||||
|
@ -43,75 +45,72 @@
|
|||
|
||||
- (OFString*)applicationName
|
||||
{
|
||||
return toOF([self qCoreApplication]->applicationName());
|
||||
return toOF(toQt(self)->applicationName());
|
||||
}
|
||||
|
||||
- (void)setApplicationName: (OFString*)applicationName
|
||||
{
|
||||
[self qCoreApplication]->setApplicationName(toQt(applicationName));
|
||||
toQt(self)->setApplicationName(toQt(applicationName));
|
||||
}
|
||||
|
||||
- (OFString*)applicationVersion
|
||||
{
|
||||
return toOF([self qCoreApplication]->applicationVersion());
|
||||
return toOF(toQt(self)->applicationVersion());
|
||||
}
|
||||
|
||||
- (void)installNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
|
||||
{
|
||||
[self qCoreApplication]->installNativeEventFilter(filterObject);
|
||||
toQt(self)->installNativeEventFilter(filterObject);
|
||||
}
|
||||
|
||||
- (void)setApplicationVersion: (OFString*)applicationVersion
|
||||
{
|
||||
[self qCoreApplication]->setApplicationVersion(
|
||||
toQt(applicationVersion));
|
||||
toQt(self)->setApplicationVersion(toQt(applicationVersion));
|
||||
}
|
||||
|
||||
- (OFString*)organizationDomain
|
||||
{
|
||||
return toOF([self qCoreApplication]->organizationDomain());
|
||||
return toOF(toQt(self)->organizationDomain());
|
||||
}
|
||||
|
||||
- (void)setOrganizationDomain: (OFString*)organizationDomain
|
||||
{
|
||||
[self qCoreApplication]->setOrganizationDomain(
|
||||
toQt(organizationDomain));
|
||||
toQt(self)->setOrganizationDomain(toQt(organizationDomain));
|
||||
}
|
||||
|
||||
- (OFString*)organizationName
|
||||
{
|
||||
return toOF([self qCoreApplication]->organizationName());
|
||||
return toOF(toQt(self)->organizationName());
|
||||
}
|
||||
|
||||
- (void)setOrganizationName: (OFString*)organizationName
|
||||
{
|
||||
[self qCoreApplication]->setOrganizationName(toQt(organizationName));
|
||||
toQt(self)->setOrganizationName(toQt(organizationName));
|
||||
}
|
||||
|
||||
- (void)quit
|
||||
{
|
||||
[self qCoreApplication]->quit();
|
||||
toQt(self)->quit();
|
||||
}
|
||||
|
||||
- (bool)isQuitLockEnabled
|
||||
{
|
||||
return [self qCoreApplication]->isQuitLockEnabled();
|
||||
return toQt(self)->isQuitLockEnabled();
|
||||
}
|
||||
|
||||
- (void)setQuitLockEnabled: (bool)quitLockEnabled
|
||||
{
|
||||
[self qCoreApplication]->setQuitLockEnabled(quitLockEnabled);
|
||||
toQt(self)->setQuitLockEnabled(quitLockEnabled);
|
||||
}
|
||||
|
||||
- (void)removeNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
|
||||
{
|
||||
[self qCoreApplication]->removeNativeEventFilter(filterObject);
|
||||
toQt(self)->removeNativeEventFilter(filterObject);
|
||||
}
|
||||
|
||||
- (bool)sendEvent: (QtEvent*)event
|
||||
receiver: (QtObject*)receiver
|
||||
{
|
||||
return [self qCoreApplication]->notify(
|
||||
[receiver qObject], [event qEvent]);
|
||||
return toQt(self)->notify(toQt(receiver), toQt(event));
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -42,3 +42,19 @@
|
|||
- (void)accept;
|
||||
- (void)ignore;
|
||||
@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;
|
||||
- (void)deleteLater;
|
||||
@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 "QtEvent.h"
|
||||
#import "QtThread.h"
|
||||
|
||||
#import "helpers.h"
|
||||
#import "OFString+QString.h"
|
||||
#import "OFDataArray+QByteArray.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
using ObjQt::toOF;
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtObject
|
||||
@synthesize qObject = _qObject;
|
||||
|
||||
|
@ -88,8 +91,7 @@
|
|||
void *pool = objc_autoreleasePoolPush();
|
||||
|
||||
for (QObject *qChild: qChildren)
|
||||
[children addObject:
|
||||
[[[QtObject alloc] initWithQObject: qChild] autorelease]];
|
||||
[children addObject: toOF(qChild)];
|
||||
|
||||
[children makeImmutable];
|
||||
|
||||
|
@ -103,7 +105,7 @@
|
|||
method: (OFString*)method
|
||||
type: (Qt::ConnectionType)type
|
||||
{
|
||||
return _qObject->connect([sender qObject],
|
||||
return _qObject->connect(toQt(sender),
|
||||
[signal UTF8String], [method UTF8String], type);
|
||||
}
|
||||
|
||||
|
@ -111,14 +113,14 @@
|
|||
receiver: (QtObject*)receiver
|
||||
method: (OFString*)method
|
||||
{
|
||||
return _qObject->disconnect([signal UTF8String], [receiver qObject],
|
||||
return _qObject->disconnect([signal UTF8String], toQt(receiver),
|
||||
[method UTF8String]);
|
||||
}
|
||||
|
||||
- (bool)disconnectAllSignalsForReceiver: (QtObject*)receiver
|
||||
method: (OFString*)method
|
||||
{
|
||||
return _qObject->disconnect([receiver qObject], [method UTF8String]);
|
||||
return _qObject->disconnect(toQt(receiver), [method UTF8String]);
|
||||
}
|
||||
|
||||
- (void)dumpObjectInfo
|
||||
|
@ -133,35 +135,31 @@
|
|||
|
||||
- (OFArray OF_GENERIC(OFDataArray*)*)dynamicPropertyNames
|
||||
{
|
||||
const QList<QByteArray> &qDynamicPropertyNames =
|
||||
const QList<QByteArray> &dynamicPropertyNames =
|
||||
_qObject->dynamicPropertyNames();
|
||||
OFMutableArray *dynamicPropertyNames =
|
||||
[OFMutableArray arrayWithCapacity: qDynamicPropertyNames.count()];
|
||||
OFMutableArray *ret =
|
||||
[OFMutableArray arrayWithCapacity: dynamicPropertyNames.count()];
|
||||
void *pool = objc_autoreleasePoolPush();
|
||||
|
||||
for (const QByteArray &qDynamicPropertyName: qDynamicPropertyNames) {
|
||||
OFDataArray *dynamicPropertyName = [OFDataArray dataArray];
|
||||
[dynamicPropertyName addItems: qDynamicPropertyName.data()
|
||||
count: qDynamicPropertyName.count()];
|
||||
[dynamicPropertyNames addObject: dynamicPropertyName];
|
||||
}
|
||||
for (const QByteArray &dynamicPropertyName: dynamicPropertyNames)
|
||||
[ret addObject: toOF(dynamicPropertyName)];
|
||||
|
||||
[dynamicPropertyNames makeImmutable];
|
||||
[ret makeImmutable];
|
||||
|
||||
objc_autoreleasePoolPop(pool);
|
||||
|
||||
return dynamicPropertyNames;
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (bool)handleEvent: (QtEvent*)event
|
||||
{
|
||||
return _qObject->event([event qEvent]);
|
||||
return _qObject->event(toQt(event));
|
||||
}
|
||||
|
||||
- (bool)filterEvent: (QtEvent*)event
|
||||
forObject: (QtObject*)watched
|
||||
{
|
||||
return _qObject->eventFilter([watched qObject], [event qEvent]);
|
||||
return _qObject->eventFilter(toQt(watched), toQt(event));
|
||||
}
|
||||
|
||||
- (bool)inheritsClassWithName: (OFString*)className
|
||||
|
@ -171,7 +169,7 @@
|
|||
|
||||
- (void)installEventFilter: (QtObject*)filterObj
|
||||
{
|
||||
_qObject->installEventFilter([filterObj qObject]);
|
||||
_qObject->installEventFilter(toQt(filterObj));
|
||||
}
|
||||
|
||||
- (bool)isWidgetType
|
||||
|
@ -196,18 +194,17 @@
|
|||
|
||||
- (void)moveToThread: (QtThread*)targetThread
|
||||
{
|
||||
_qObject->moveToThread([targetThread qThread]);
|
||||
_qObject->moveToThread(toQt(targetThread));
|
||||
}
|
||||
|
||||
- (QtObject*)parent
|
||||
{
|
||||
return [[[QtObject alloc]
|
||||
initWithQObject: _qObject->parent()] autorelease];
|
||||
return toOF(_qObject->parent());
|
||||
}
|
||||
|
||||
- (void)setParent: (QtObject*)parent
|
||||
{
|
||||
_qObject->setParent([parent qObject]);
|
||||
_qObject->setParent(toQt(parent));
|
||||
}
|
||||
|
||||
- (QVariant)propertyForName: (OFString*)name
|
||||
|
@ -217,7 +214,7 @@
|
|||
|
||||
- (void)removeEventFilter: (QtObject*)obj
|
||||
{
|
||||
_qObject->removeEventFilter([obj qObject]);
|
||||
_qObject->removeEventFilter(toQt(obj));
|
||||
}
|
||||
|
||||
- (bool)setProperty: (QVariant&)value
|
||||
|
@ -239,8 +236,7 @@
|
|||
|
||||
- (QtThread*)thread
|
||||
{
|
||||
return [[[QtThread alloc]
|
||||
initWithQThread: _qObject->thread()] autorelease];
|
||||
return toOF(_qObject->thread());
|
||||
}
|
||||
|
||||
- (void)deleteLater
|
||||
|
|
|
@ -42,3 +42,19 @@
|
|||
- (void)startWithPriority: (QThread::Priority)priority;
|
||||
- (void)terminate;
|
||||
@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"
|
||||
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtThread: QtObject
|
||||
- initWithQObject: (QObject*)qObject
|
||||
{
|
||||
|
@ -40,81 +42,81 @@
|
|||
|
||||
- (QAbstractEventDispatcher*)eventDispatcher
|
||||
{
|
||||
return [self qThread]->eventDispatcher();
|
||||
return toQt(self)->eventDispatcher();
|
||||
}
|
||||
|
||||
- (void)setEventDispatcher: (QAbstractEventDispatcher*)eventDispatcher
|
||||
{
|
||||
[self qThread]->setEventDispatcher(eventDispatcher);
|
||||
toQt(self)->setEventDispatcher(eventDispatcher);
|
||||
}
|
||||
|
||||
- (void)exitWithReturnCode: (int)returnCode
|
||||
{
|
||||
[self qThread]->exit(returnCode);
|
||||
toQt(self)->exit(returnCode);
|
||||
}
|
||||
|
||||
- (bool)isFinished
|
||||
{
|
||||
return [self qThread]->isFinished();
|
||||
return toQt(self)->isFinished();
|
||||
}
|
||||
|
||||
- (bool)isInterruptionRequested
|
||||
{
|
||||
return [self qThread]->isInterruptionRequested();
|
||||
return toQt(self)->isInterruptionRequested();
|
||||
}
|
||||
|
||||
- (bool)isRunning
|
||||
{
|
||||
return [self qThread]->isRunning();
|
||||
return toQt(self)->isRunning();
|
||||
}
|
||||
|
||||
- (int)loopLevel
|
||||
{
|
||||
return [self qThread]->loopLevel();
|
||||
return toQt(self)->loopLevel();
|
||||
}
|
||||
|
||||
- (QThread::Priority)priority
|
||||
{
|
||||
return [self qThread]->priority();
|
||||
return toQt(self)->priority();
|
||||
}
|
||||
|
||||
- (void)setPriority: (QThread::Priority)priority
|
||||
{
|
||||
[self qThread]->setPriority(priority);
|
||||
toQt(self)->setPriority(priority);
|
||||
}
|
||||
|
||||
- (void)requestInterruption
|
||||
{
|
||||
[self qThread]->requestInterruption();
|
||||
toQt(self)->requestInterruption();
|
||||
}
|
||||
|
||||
- (unsigned int)stackSize
|
||||
{
|
||||
return [self qThread]->stackSize();
|
||||
return toQt(self)->stackSize();
|
||||
}
|
||||
|
||||
- (void)setStackSize: (unsigned int)stackSize
|
||||
{
|
||||
[self qThread]->setStackSize(stackSize);
|
||||
toQt(self)->setStackSize(stackSize);
|
||||
}
|
||||
|
||||
- (bool)waitForMilliseconds: (unsigned long)time
|
||||
{
|
||||
return [self qThread]->wait(time);
|
||||
return toQt(self)->wait(time);
|
||||
}
|
||||
|
||||
- (void)quit
|
||||
{
|
||||
[self qThread]->quit();
|
||||
toQt(self)->quit();
|
||||
}
|
||||
|
||||
- (void)startWithPriority: (QThread::Priority)priority
|
||||
{
|
||||
[self qThread]->start(priority);
|
||||
toQt(self)->start(priority);
|
||||
}
|
||||
|
||||
- (void)terminate
|
||||
{
|
||||
[self qThread]->terminate();
|
||||
toQt(self)->terminate();
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
#include <QGuiApplication>
|
||||
|
||||
@interface QtGuiApplication: QtCoreApplication
|
||||
@interface QtGUIApplication: QtCoreApplication
|
||||
@property (readonly) QGuiApplication *qGuiApplication;
|
||||
@property (copy) OFString *applicationDisplayName;
|
||||
@property (copy) OFString *desktopFileName;
|
||||
@property Qt::LayoutDirection layoutDirection;
|
||||
@property (readonly, copy) OFString *platformName;
|
||||
@property (readonly) QScreen *primaryScreen;
|
||||
@property bool quitOnLastWindowClosed;
|
||||
@property bool quitsOnLastWindowClosed;
|
||||
@property QIcon windowIcon;
|
||||
|
||||
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication;
|
||||
|
@ -41,3 +41,20 @@
|
|||
- (OFString*)sessionID;
|
||||
- (OFString*)sessionKey;
|
||||
@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.
|
||||
*/
|
||||
|
||||
#import "QtGuiApplication.h"
|
||||
|
||||
#import "helpers.h"
|
||||
#import "QtGUIApplication.h"
|
||||
#import "OFString+QString.h"
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
@implementation QtGuiApplication
|
||||
using ObjQt::toOF;
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtGUIApplication
|
||||
- initWithQCoreApplication: (QCoreApplication*)qCoreApplication
|
||||
{
|
||||
OF_INVALID_INIT_METHOD
|
||||
|
@ -44,88 +46,86 @@
|
|||
|
||||
- (OFString*)applicationDisplayName
|
||||
{
|
||||
return toOF([self qGuiApplication]->applicationDisplayName());
|
||||
return toOF(toQt(self)->applicationDisplayName());
|
||||
}
|
||||
|
||||
- (void)setApplicationDisplayName: (OFString*)applicationDisplayName
|
||||
{
|
||||
[self qGuiApplication]->setApplicationDisplayName(
|
||||
toQt(applicationDisplayName));
|
||||
toQt(self)->setApplicationDisplayName(toQt(applicationDisplayName));
|
||||
}
|
||||
|
||||
- (OFString*)desktopFileName
|
||||
{
|
||||
return toOF([self qGuiApplication]->desktopFileName());
|
||||
return toOF(toQt(self)->desktopFileName());
|
||||
}
|
||||
|
||||
- (void)setDesktopFileName: (OFString*)desktopFileName
|
||||
{
|
||||
[self qGuiApplication]->setDesktopFileName(toQt(desktopFileName));
|
||||
toQt(self)->setDesktopFileName(toQt(desktopFileName));
|
||||
}
|
||||
|
||||
- (double)devicePixelRatio
|
||||
{
|
||||
return [self qGuiApplication]->devicePixelRatio();
|
||||
return toQt(self)->devicePixelRatio();
|
||||
}
|
||||
|
||||
- (bool)isSavingSession
|
||||
{
|
||||
return [self qGuiApplication]->isSavingSession();
|
||||
return toQt(self)->isSavingSession();
|
||||
}
|
||||
|
||||
- (bool)isSessionRestored
|
||||
{
|
||||
return [self qGuiApplication]->isSessionRestored();
|
||||
return toQt(self)->isSessionRestored();
|
||||
}
|
||||
|
||||
- (Qt::LayoutDirection)layoutDirection
|
||||
{
|
||||
return [self qGuiApplication]->layoutDirection();
|
||||
return toQt(self)->layoutDirection();
|
||||
}
|
||||
|
||||
- (void)setLayoutDirection: (Qt::LayoutDirection)layoutDirection
|
||||
{
|
||||
[self qGuiApplication]->setLayoutDirection(layoutDirection);
|
||||
toQt(self)->setLayoutDirection(layoutDirection);
|
||||
}
|
||||
|
||||
- (OFString*)platformName
|
||||
{
|
||||
return toOF([self qGuiApplication]->platformName());
|
||||
return toOF(toQt(self)->platformName());
|
||||
}
|
||||
|
||||
- (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(
|
||||
quitOnLastWindowClosed);
|
||||
toQt(self)->setQuitOnLastWindowClosed(quitsOnLastWindowClosed);
|
||||
}
|
||||
|
||||
- (OFString*)sessionID
|
||||
{
|
||||
return toOF([self qGuiApplication]->sessionId());
|
||||
return toOF(toQt(self)->sessionId());
|
||||
}
|
||||
|
||||
- (OFString*)sessionKey
|
||||
{
|
||||
return toOF([self qGuiApplication]->sessionKey());
|
||||
return toOF(toQt(self)->sessionKey());
|
||||
}
|
||||
|
||||
- (QIcon)windowIcon
|
||||
{
|
||||
return [self qGuiApplication]->windowIcon();
|
||||
return toQt(self)->windowIcon();
|
||||
}
|
||||
|
||||
- (void)setWindowIcon: (QIcon)windowIcon
|
||||
{
|
||||
[self qGuiApplication]->setWindowIcon(windowIcon);
|
||||
toQt(self)->setWindowIcon(windowIcon);
|
||||
}
|
||||
@end
|
|
@ -45,3 +45,13 @@
|
|||
@interface QtPaintDevice: OFObject <QtPaintDevice>
|
||||
@property (readonly) QObject *qObject;
|
||||
@end
|
||||
|
||||
namespace ObjQt {
|
||||
|
||||
static OF_INLINE QPaintDevice*
|
||||
toQt(QtPaintDevice *paintDevice)
|
||||
{
|
||||
return [paintDevice qPaintDevice];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include <QObject>
|
||||
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtPaintDevice
|
||||
@dynamic qObject;
|
||||
|
||||
|
@ -34,71 +36,71 @@
|
|||
|
||||
- (int)colorCount
|
||||
{
|
||||
return [self qPaintDevice]->colorCount();
|
||||
return toQt(self)->colorCount();
|
||||
}
|
||||
|
||||
- (int)depth
|
||||
{
|
||||
return [self qPaintDevice]->depth();
|
||||
return toQt(self)->depth();
|
||||
}
|
||||
|
||||
- (int)devicePixelRatio
|
||||
{
|
||||
return [self qPaintDevice]->devicePixelRatio();
|
||||
return toQt(self)->devicePixelRatio();
|
||||
}
|
||||
|
||||
- (double)devicePixelRatioF
|
||||
{
|
||||
return [self qPaintDevice]->devicePixelRatioF();
|
||||
return toQt(self)->devicePixelRatioF();
|
||||
}
|
||||
|
||||
- (int)height
|
||||
{
|
||||
return [self qPaintDevice]->height();
|
||||
return toQt(self)->height();
|
||||
}
|
||||
|
||||
- (int)heightMM
|
||||
{
|
||||
return [self qPaintDevice]->heightMM();
|
||||
return toQt(self)->heightMM();
|
||||
}
|
||||
|
||||
- (int)logicalDPIX
|
||||
{
|
||||
return [self qPaintDevice]->logicalDpiX();
|
||||
return toQt(self)->logicalDpiX();
|
||||
}
|
||||
|
||||
- (int)logicalDPIY
|
||||
{
|
||||
return [self qPaintDevice]->logicalDpiY();
|
||||
return toQt(self)->logicalDpiY();
|
||||
}
|
||||
|
||||
- (QPaintEngine*)paintEngine
|
||||
{
|
||||
return [self qPaintDevice]->paintEngine();
|
||||
return toQt(self)->paintEngine();
|
||||
}
|
||||
|
||||
- (bool)paintingActive
|
||||
{
|
||||
return [self qPaintDevice]->paintingActive();
|
||||
return toQt(self)->paintingActive();
|
||||
}
|
||||
|
||||
- (int)physicalDPIX
|
||||
{
|
||||
return [self qPaintDevice]->physicalDpiX();
|
||||
return toQt(self)->physicalDpiX();
|
||||
}
|
||||
|
||||
- (int)physicalDPIY
|
||||
{
|
||||
return [self qPaintDevice]->physicalDpiY();
|
||||
return toQt(self)->physicalDpiY();
|
||||
}
|
||||
|
||||
- (int)width
|
||||
{
|
||||
return [self qPaintDevice]->width();
|
||||
return toQt(self)->width();
|
||||
}
|
||||
|
||||
- (int)widthMM
|
||||
{
|
||||
return [self qPaintDevice]->widthMM();
|
||||
return toQt(self)->widthMM();
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
- (QMenu*)menu;
|
||||
- (QtWidget*)parentWidget;
|
||||
- (void)setActionGroup: (QActionGroup*)group;
|
||||
- (void)setData: (const QVariant&)data;
|
||||
- (void)setMenu: (QMenu*)menu;
|
||||
- (void)setSeparator: (bool)isSeparator;
|
||||
- (void)setShortcuts: (const QList<QKeySequence>&)shortcuts;
|
||||
|
@ -63,3 +64,19 @@
|
|||
- (QList<QKeySequence>)shortcuts;
|
||||
- (bool)showStatusText: (QtWidget*)widget;
|
||||
@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 "QtWidget.h"
|
||||
#import "OFString+QString.h"
|
||||
|
||||
#import "helpers.h"
|
||||
using ObjQt::toOF;
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtAction
|
||||
- initWithQObject: (QObject*)qObject
|
||||
|
@ -43,199 +45,198 @@
|
|||
|
||||
- (bool)autoRepeat
|
||||
{
|
||||
return [self qAction]->autoRepeat();
|
||||
return toQt(self)->autoRepeat();
|
||||
}
|
||||
|
||||
- (void)setAutoRepeat: (bool)autoRepeat
|
||||
{
|
||||
[self qAction]->setAutoRepeat(autoRepeat);
|
||||
toQt(self)->setAutoRepeat(autoRepeat);
|
||||
}
|
||||
|
||||
- (bool)isCheckable
|
||||
{
|
||||
return [self qAction]->isCheckable();
|
||||
return toQt(self)->isCheckable();
|
||||
}
|
||||
|
||||
- (void)setCheckable: (bool)checkable
|
||||
{
|
||||
[self qAction]->setCheckable(checkable);
|
||||
toQt(self)->setCheckable(checkable);
|
||||
}
|
||||
|
||||
- (bool)isChecked
|
||||
{
|
||||
return [self qAction]->isChecked();
|
||||
return toQt(self)->isChecked();
|
||||
}
|
||||
|
||||
- (void)setChecked: (bool)checked
|
||||
{
|
||||
[self qAction]->setChecked(checked);
|
||||
toQt(self)->setChecked(checked);
|
||||
}
|
||||
|
||||
- (bool)isEnabled
|
||||
{
|
||||
return [self qAction]->isEnabled();
|
||||
return toQt(self)->isEnabled();
|
||||
}
|
||||
|
||||
- (void)setEnabled: (bool)enabled
|
||||
{
|
||||
[self qAction]->setEnabled(enabled);
|
||||
toQt(self)->setEnabled(enabled);
|
||||
}
|
||||
|
||||
- (QFont)font
|
||||
{
|
||||
return [self qAction]->font();
|
||||
return toQt(self)->font();
|
||||
}
|
||||
|
||||
- (void)setFont: (QFont)font
|
||||
{
|
||||
[self qAction]->setFont(font);
|
||||
toQt(self)->setFont(font);
|
||||
}
|
||||
|
||||
- (QIcon)icon
|
||||
{
|
||||
return [self qAction]->icon();
|
||||
return toQt(self)->icon();
|
||||
}
|
||||
|
||||
- (void)setIcon: (QIcon)icon
|
||||
{
|
||||
[self qAction]->setIcon(icon);
|
||||
toQt(self)->setIcon(icon);
|
||||
}
|
||||
|
||||
- (OFString*)iconText
|
||||
{
|
||||
return toOF([self qAction]->iconText());
|
||||
return toOF(toQt(self)->iconText());
|
||||
}
|
||||
|
||||
- (void)setIconText: (OFString*)iconText
|
||||
{
|
||||
[self qAction]->setIconText(toQt(iconText));
|
||||
toQt(self)->setIconText(toQt(iconText));
|
||||
}
|
||||
|
||||
- (bool)isIconVisibleInMenu
|
||||
{
|
||||
return [self qAction]->isIconVisibleInMenu();
|
||||
return toQt(self)->isIconVisibleInMenu();
|
||||
}
|
||||
|
||||
- (void)setIconVisibleInMenu: (bool)iconVisibleInMenu
|
||||
{
|
||||
[self qAction]->setIconVisibleInMenu(iconVisibleInMenu);
|
||||
toQt(self)->setIconVisibleInMenu(iconVisibleInMenu);
|
||||
}
|
||||
|
||||
- (QAction::MenuRole)menuRole
|
||||
{
|
||||
return [self qAction]->menuRole();
|
||||
return toQt(self)->menuRole();
|
||||
}
|
||||
|
||||
- (void)setMenuRole: (QAction::MenuRole)menuRole
|
||||
{
|
||||
[self qAction]->setMenuRole(menuRole);
|
||||
toQt(self)->setMenuRole(menuRole);
|
||||
}
|
||||
|
||||
- (QAction::Priority)priority
|
||||
{
|
||||
return [self qAction]->priority();
|
||||
return toQt(self)->priority();
|
||||
}
|
||||
|
||||
- (void)setPriority: (QAction::Priority)priority
|
||||
{
|
||||
[self qAction]->setPriority(priority);
|
||||
toQt(self)->setPriority(priority);
|
||||
}
|
||||
|
||||
- (QKeySequence)shortcut
|
||||
{
|
||||
return [self qAction]->shortcut();
|
||||
return toQt(self)->shortcut();
|
||||
}
|
||||
|
||||
- (void)setShortcut: (QKeySequence)shortcut
|
||||
{
|
||||
[self qAction]->setShortcut(shortcut);
|
||||
toQt(self)->setShortcut(shortcut);
|
||||
}
|
||||
|
||||
- (Qt::ShortcutContext)shortcutContext
|
||||
{
|
||||
return [self qAction]->shortcutContext();
|
||||
return toQt(self)->shortcutContext();
|
||||
}
|
||||
|
||||
- (void)setShortcutContext: (Qt::ShortcutContext)shortcutContext
|
||||
{
|
||||
[self qAction]->setShortcutContext(shortcutContext);
|
||||
toQt(self)->setShortcutContext(shortcutContext);
|
||||
}
|
||||
|
||||
- (OFString*)statusTip
|
||||
{
|
||||
return toOF([self qAction]->statusTip());
|
||||
return toOF(toQt(self)->statusTip());
|
||||
}
|
||||
|
||||
- (void)setStatusTip: (OFString*)statusTip
|
||||
{
|
||||
[self qAction]->setStatusTip(toQt(statusTip));
|
||||
toQt(self)->setStatusTip(toQt(statusTip));
|
||||
}
|
||||
|
||||
- (OFString*)text
|
||||
{
|
||||
return toOF([self qAction]->text());
|
||||
return toOF(toQt(self)->text());
|
||||
}
|
||||
|
||||
- (void)setText: (OFString*)text
|
||||
{
|
||||
[self qAction]->setText(toQt(text));
|
||||
toQt(self)->setText(toQt(text));
|
||||
}
|
||||
|
||||
- (OFString*)toolTip
|
||||
{
|
||||
return toOF([self qAction]->toolTip());
|
||||
return toOF(toQt(self)->toolTip());
|
||||
}
|
||||
|
||||
- (void)setToolTip: (OFString*)toolTip
|
||||
{
|
||||
[self qAction]->setToolTip(toQt(toolTip));
|
||||
toQt(self)->setToolTip(toQt(toolTip));
|
||||
}
|
||||
|
||||
- (bool)isVisible
|
||||
{
|
||||
return [self qAction]->isVisible();
|
||||
return toQt(self)->isVisible();
|
||||
}
|
||||
|
||||
- (void)setVisible: (bool)visible
|
||||
{
|
||||
[self qAction]->setVisible(visible);
|
||||
toQt(self)->setVisible(visible);
|
||||
}
|
||||
|
||||
- (OFString*)whatsThis
|
||||
{
|
||||
return toOF([self qAction]->whatsThis());
|
||||
return toOF(toQt(self)->whatsThis());
|
||||
}
|
||||
|
||||
- (void)setWhatsThis: (OFString*)whatsThis
|
||||
{
|
||||
[self qAction]->setWhatsThis(toQt(whatsThis));
|
||||
toQt(self)->setWhatsThis(toQt(whatsThis));
|
||||
}
|
||||
|
||||
- (QActionGroup*)actionGroup
|
||||
{
|
||||
return [self qAction]->actionGroup();
|
||||
return toQt(self)->actionGroup();
|
||||
}
|
||||
|
||||
- (void)activate: (QAction::ActionEvent)event
|
||||
{
|
||||
[self qAction]->activate(event);
|
||||
toQt(self)->activate(event);
|
||||
}
|
||||
|
||||
- (QList<QGraphicsWidget*>)associatedGraphicsWidgets
|
||||
{
|
||||
return [self qAction]->associatedGraphicsWidgets();
|
||||
return toQt(self)->associatedGraphicsWidgets();
|
||||
}
|
||||
|
||||
- (OFArray OF_GENERIC(QtWidget*)*)associatedWidgets
|
||||
{
|
||||
const QList<QWidget*> &widgets = [self qAction]->associatedWidgets();
|
||||
const QList<QWidget*> &widgets = toQt(self)->associatedWidgets();
|
||||
OFMutableArray *ret =
|
||||
[OFMutableArray arrayWithCapacity: widgets.count()];
|
||||
void *pool = objc_autoreleasePoolPush();
|
||||
|
||||
for (QWidget *widget: widgets)
|
||||
[ret addObject:
|
||||
[[[QtWidget alloc] initWithQWidget: widget] autorelease]];
|
||||
[ret addObject: toOF(widget)];
|
||||
|
||||
[ret makeImmutable];
|
||||
|
||||
|
@ -246,57 +247,61 @@
|
|||
|
||||
- (QVariant)data
|
||||
{
|
||||
return [self qAction]->data();
|
||||
return toQt(self)->data();
|
||||
}
|
||||
|
||||
- (bool)isSeparator
|
||||
{
|
||||
return [self qAction]->isSeparator();
|
||||
return toQt(self)->isSeparator();
|
||||
}
|
||||
|
||||
- (QMenu*)menu
|
||||
{
|
||||
return [self qAction]->menu();
|
||||
return toQt(self)->menu();
|
||||
}
|
||||
|
||||
- (QtWidget*)parentWidget
|
||||
{
|
||||
return [[[QtWidget alloc] initWithQWidget:
|
||||
[self qAction]->parentWidget()] autorelease];
|
||||
return toOF(toQt(self)->parentWidget());
|
||||
}
|
||||
|
||||
- (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
|
||||
{
|
||||
[self qAction]->setMenu(menu);
|
||||
toQt(self)->setMenu(menu);
|
||||
}
|
||||
|
||||
- (void)setSeparator: (bool)isSeparator
|
||||
{
|
||||
[self qAction]->setSeparator(isSeparator);
|
||||
toQt(self)->setSeparator(isSeparator);
|
||||
}
|
||||
|
||||
- (void)setShortcuts: (const QList<QKeySequence>&)shortcuts
|
||||
{
|
||||
[self qAction]->setShortcuts(shortcuts);
|
||||
toQt(self)->setShortcuts(shortcuts);
|
||||
}
|
||||
|
||||
- (void)setShortcutsWithStandardKey: (QKeySequence::StandardKey)key
|
||||
{
|
||||
[self qAction]->setShortcuts(key);
|
||||
toQt(self)->setShortcuts(key);
|
||||
}
|
||||
|
||||
- (QList<QKeySequence>)shortcuts
|
||||
{
|
||||
return [self qAction]->shortcuts();
|
||||
return toQt(self)->shortcuts();
|
||||
}
|
||||
|
||||
- (bool)showStatusText: (QtWidget*)widget
|
||||
{
|
||||
return [self qAction]->showStatusText([widget qWidget]);
|
||||
return toQt(self)->showStatusText(toQt(widget));
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "QtGuiApplication.h"
|
||||
#import "QtGUIApplication.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
@interface QtApplication: QtGuiApplication
|
||||
@interface QtApplication: QtGUIApplication
|
||||
@property (readonly) QApplication *qApplication;
|
||||
@property bool autoSipEnabled;
|
||||
@property bool autoSIPEnabled;
|
||||
@property int cursorFlashTime;
|
||||
@property int doubleClickInterval;
|
||||
@property of_dimension_t globalStrut;
|
||||
|
@ -38,7 +38,22 @@
|
|||
|
||||
- initWithQApplication: (QApplication*)qApplication;
|
||||
- (void)aboutQt;
|
||||
- (bool)autoSipEnabled;
|
||||
- (void)closeAllWindows;
|
||||
- (void)setAutoSipEnabled: (bool)enabled;
|
||||
@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 "OFString+QString.h"
|
||||
|
||||
#import "helpers.h"
|
||||
|
||||
using ObjQt::toOF;
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtApplication
|
||||
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication
|
||||
{
|
||||
|
@ -40,103 +44,103 @@
|
|||
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
|
||||
{
|
||||
return [self qApplication]->cursorFlashTime();
|
||||
return toQt(self)->cursorFlashTime();
|
||||
}
|
||||
|
||||
- (void)setCursorFlashTime: (int)cursorFlashTime
|
||||
{
|
||||
[self qApplication]->setCursorFlashTime(cursorFlashTime);
|
||||
toQt(self)->setCursorFlashTime(cursorFlashTime);
|
||||
}
|
||||
|
||||
- (int)doubleClickInterval
|
||||
{
|
||||
return [self qApplication]->doubleClickInterval();
|
||||
return toQt(self)->doubleClickInterval();
|
||||
}
|
||||
|
||||
- (void)setDoubleClickInterval: (int)doubleClickInterval
|
||||
{
|
||||
[self qApplication]->setDoubleClickInterval(doubleClickInterval);
|
||||
toQt(self)->setDoubleClickInterval(doubleClickInterval);
|
||||
}
|
||||
|
||||
- (of_dimension_t)globalStrut
|
||||
{
|
||||
return toOF([self qApplication]->globalStrut());
|
||||
return toOF(toQt(self)->globalStrut());
|
||||
}
|
||||
|
||||
- (void)setGlobalStrut: (of_dimension_t)globalStrut
|
||||
{
|
||||
[self qApplication]->setGlobalStrut(toQt(globalStrut));
|
||||
toQt(self)->setGlobalStrut(toQt(globalStrut));
|
||||
}
|
||||
|
||||
- (int)keyboardInputInterval
|
||||
{
|
||||
return [self qApplication]->keyboardInputInterval();
|
||||
return toQt(self)->keyboardInputInterval();
|
||||
}
|
||||
|
||||
- (void)setKeyboardInputInterval: (int)keyboardInputInterval
|
||||
{
|
||||
[self qApplication]->setKeyboardInputInterval(keyboardInputInterval);
|
||||
toQt(self)->setKeyboardInputInterval(keyboardInputInterval);
|
||||
}
|
||||
|
||||
- (int)startDragDistance
|
||||
{
|
||||
return [self qApplication]->startDragDistance();
|
||||
return toQt(self)->startDragDistance();
|
||||
}
|
||||
|
||||
- (void)setStartDragDistance: (int)startDragDistance
|
||||
{
|
||||
[self qApplication]->setStartDragDistance(startDragDistance);
|
||||
toQt(self)->setStartDragDistance(startDragDistance);
|
||||
}
|
||||
|
||||
- (int)startDragTime
|
||||
{
|
||||
return [self qApplication]->startDragTime();
|
||||
return toQt(self)->startDragTime();
|
||||
}
|
||||
|
||||
- (void)setStartDragTime: (int)startDragTime
|
||||
{
|
||||
[self qApplication]->setStartDragTime(startDragTime);
|
||||
toQt(self)->setStartDragTime(startDragTime);
|
||||
}
|
||||
|
||||
- (OFString*)styleSheet
|
||||
{
|
||||
return toOF([self qApplication]->styleSheet());
|
||||
return toOF(toQt(self)->styleSheet());
|
||||
}
|
||||
|
||||
- (void)setStyleSheet: (OFString*)styleSheet
|
||||
{
|
||||
[self qApplication]->setStyleSheet(toQt(styleSheet));
|
||||
toQt(self)->setStyleSheet(toQt(styleSheet));
|
||||
}
|
||||
|
||||
- (int)wheelScrollLines
|
||||
{
|
||||
return [self qApplication]->wheelScrollLines();
|
||||
return toQt(self)->wheelScrollLines();
|
||||
}
|
||||
|
||||
- (void)setWheelScrollLines: (int)wheelScrollLines
|
||||
{
|
||||
[self qApplication]->setWheelScrollLines(wheelScrollLines);
|
||||
toQt(self)->setWheelScrollLines(wheelScrollLines);
|
||||
}
|
||||
|
||||
- (void)aboutQt
|
||||
{
|
||||
[self qApplication]->aboutQt();
|
||||
toQt(self)->aboutQt();
|
||||
}
|
||||
|
||||
- (void)closeAllWindows
|
||||
{
|
||||
[self qApplication]->closeAllWindows();
|
||||
toQt(self)->closeAllWindows();
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
@property Qt::ContextMenuPolicy contextMenuPolicy;
|
||||
@property QCursor cursor;
|
||||
@property (getter=isEnabled) bool enabled;
|
||||
@property (readonly, getter=hasFocus) bool focus;
|
||||
@property Qt::FocusPolicy focusPolicy;
|
||||
@property const QFont &font;
|
||||
@property (readonly) of_rectangle_t frameGeometry;
|
||||
|
@ -78,7 +77,6 @@
|
|||
@property (getter=isVisible) bool visible;
|
||||
@property (copy) OFString *whatsThis;
|
||||
@property (readonly) int width;
|
||||
@property (copy) OFString *windowFilePath;
|
||||
@property Qt::WindowFlags windowFlags;
|
||||
@property QIcon windowIcon;
|
||||
@property Qt::WindowModality windowModality;
|
||||
|
@ -101,7 +99,7 @@
|
|||
- (void)clearMask;
|
||||
- (QMargins)contentsMargins;
|
||||
- (of_rectangle_t)contentsRect;
|
||||
- (WId)effectiveWinId;
|
||||
- (WId)effectiveWinID;
|
||||
- (void)ensurePolished;
|
||||
- (QtWidget*)focusProxy;
|
||||
- (QtWidget*)focusWidget;
|
||||
|
@ -123,6 +121,7 @@
|
|||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
- (bool)hasEditFocus;
|
||||
#endif
|
||||
- (bool)hasFocus;
|
||||
- (bool)hasHeightForWidth;
|
||||
- (int)heightForWidth: (int)w;
|
||||
- (QVariant)queryInputMethod: (Qt::InputMethodQuery)query;
|
||||
|
@ -135,19 +134,107 @@
|
|||
- (bool)isHidden;
|
||||
- (bool)isVisibleTo: (QtWidget*)ancestor;
|
||||
- (bool)isWindow;
|
||||
// QPoint mapFrom(const QWidget *parent, const QPoint &pos) const
|
||||
// QPoint mapFromGlobal(const QPoint &pos) const
|
||||
// QPoint mapFromParent(const QPoint &pos) const
|
||||
// QPoint mapTo(const QWidget *parent, const QPoint &pos) const
|
||||
// QPoint mapToGlobal(const QPoint &pos) const
|
||||
// QPoint mapToParent(const QPoint &pos) const
|
||||
// QRegion mask() const
|
||||
// ...
|
||||
|
||||
- (of_point_t)mapPosition: (of_point_t)pos
|
||||
from: (QtWidget*)parent;
|
||||
- (of_point_t)mapPositionFromGlobal: (of_point_t)pos;
|
||||
- (of_point_t)mapPositionFromParent: (of_point_t)pos;
|
||||
- (of_point_t)mapPosition: (of_point_t)pos
|
||||
to: (QtWidget*)parent;
|
||||
- (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)unsetLayoutDirection;
|
||||
- (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
|
||||
|
||||
@interface QtWidget (QtPaintDevice) <QtPaintDevice>
|
||||
@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;
|
||||
- (QString)qString;
|
||||
@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>
|
||||
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
#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*
|
||||
toOF(const QString &qString)
|
||||
{
|
||||
return [OFString stringWithQString: qString];
|
||||
}
|
||||
|
||||
static OF_INLINE QString
|
||||
toQt(OFString *string)
|
||||
{
|
||||
return [string qString];
|
||||
}
|
||||
namespace ObjQt {
|
||||
|
||||
static OF_INLINE of_point_t
|
||||
toOF(const QPoint &qPoint)
|
||||
|
@ -77,3 +71,5 @@ toQt(of_rectangle_t rectangle)
|
|||
return QRect(rectangle.origin.x, rectangle.origin.y,
|
||||
rectangle.size.width, rectangle.size.height);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue