Initial commit

This commit is contained in:
Jonathan Schleifer 2017-04-02 22:51:55 +02:00
commit f38ff5fbc2
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3
18 changed files with 1016 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
*~
.qmake.stash
build
Makefile

35
ObjQt.pro Normal file
View file

@ -0,0 +1,35 @@
TEMPLATE = lib
TARGET = ObjQt
DESTDIR = build
OBJECTS_DIR = build
QT += core gui widgets
INCLUDEPATH += common \
QtCore \
QtGui \
QtWidgets
HEADERS += common/helpers.h \
common/QtOwnershipManaging.h \
QtCore/QtChildEvent.h \
QtCore/QtCoreApplication.h \
QtCore/QtEvent.h \
QtCore/QtObject.h \
QtCore/QtThread.h \
QtGui/QtGuiApplication.h \
QtWidgets/QtApplication.h
SOURCES += QtCore/QtChildEvent.mm \
QtCore/QtCoreApplication.mm \
QtCore/QtEvent.mm \
QtCore/QtObject.mm \
QtCore/QtThread.mm \
QtGui/QtGuiApplication.mm \
QtWidgets/QtApplication.mm
QMAKE_CXXFLAGS += $$system("objfw-config --cppflags --objcflags --cxxflags")
QMAKE_CXXFLAGS_WARN_ON = -Wall \
-Werror \
-Wsemicolon-before-method-body \
-Wobjc-missing-property-synthesis
LIBS += $$system("objfw-config --ldflags --libs")

15
QtCore/QtChildEvent.h Normal file
View file

@ -0,0 +1,15 @@
#import "QtEvent.h"
@class QtObject;
@interface QtChildEvent: QtEvent
@property (readonly) QChildEvent *qChildEvent;
@property (readonly, getter=isAdded) bool added;
@property (readonly, retain) QtObject *child;
@property (readonly, getter=isPolished) bool polished;
@property (readonly, getter=isRemoved) bool removed;
- initWithQChildEvent: (QChildEvent*)qChildEvent;
- initWithType: (QChildEvent::Type)type
child: (QtObject*)child;
@end

53
QtCore/QtChildEvent.mm Normal file
View file

@ -0,0 +1,53 @@
#import "QtChildEvent.h"
#import "QtObject.h"
@implementation QtChildEvent
- initWithQEvent: (QEvent*)event
{
OF_INVALID_INIT_METHOD
}
- initWithQChildEvent: (QChildEvent*)event
{
return [super initWithQEvent: event];
}
- initWithType: (QChildEvent::Type)type
child: (QtObject*)child
{
try {
return [self initWithQChildEvent:
new QChildEvent(type, [child qObject])];
} catch (const std::bad_alloc &e) {
self = [super initWithQEvent: NULL];
[self release];
throw;
}
}
- (QChildEvent*)qChildEvent
{
return dynamic_cast<QChildEvent*>(_qEvent);
}
- (bool)isAdded
{
return [self qChildEvent]->added();
}
- (QtObject*)child
{
return [[[QtObject alloc]
initWithQObject: [self qChildEvent]->child()] autorelease];
}
- (bool)isPolished
{
return [self qChildEvent]->polished();
}
- (bool)isRemoved
{
return [self qChildEvent]->removed();
}
@end

View file

@ -0,0 +1,17 @@
#import "QtObject.h"
#include <QCoreApplication>
@interface QtCoreApplication: QtObject
@property (readonly) QCoreApplication *qCoreApplication;
@property (copy) OFString *applicationName, *applicationVersion;
@property (copy) OFString *organizationDomain, *organizationName;
@property (getter=isQuitLockEnabled) bool quitLockEnabled;
- initWithQCoreApplication: (QCoreApplication*)qCoreApplication;
- (void)installNativeEventFilter: (QAbstractNativeEventFilter*)filterObject;
- (void)quit;
- (void)removeNativeEventFilter: (QAbstractNativeEventFilter*)filterObject;
- (bool)sendEvent: (QtEvent*)event
receiver: (QtObject*)receiver;
@end

View file

@ -0,0 +1,97 @@
#import "QtCoreApplication.h"
#import "QtEvent.h"
#import "helpers.h"
@implementation QtCoreApplication
- initWithQObject: (QObject*)qObject
{
OF_INVALID_INIT_METHOD
}
- initWithQCoreApplication: (QCoreApplication*)qCoreApplication
{
return [super initWithQObject: qCoreApplication];
}
- (QCoreApplication*)qCoreApplication
{
return qobject_cast<QCoreApplication*>(_qObject);
}
- (OFString*)applicationName
{
return QToOFString([self qCoreApplication]->applicationName());
}
- (void)setApplicationName: (OFString*)applicationName
{
[self qCoreApplication]->setApplicationName(
OFToQString(applicationName));
}
- (OFString*)applicationVersion
{
return QToOFString([self qCoreApplication]->applicationVersion());
}
- (void)installNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
{
[self qCoreApplication]->installNativeEventFilter(filterObject);
}
- (void)setApplicationVersion: (OFString*)applicationVersion
{
[self qCoreApplication]->setApplicationVersion(
OFToQString(applicationVersion));
}
- (OFString*)organizationDomain
{
return QToOFString([self qCoreApplication]->organizationDomain());
}
- (void)setOrganizationDomain: (OFString*)organizationDomain
{
[self qCoreApplication]->setOrganizationDomain(
OFToQString(organizationDomain));
}
- (OFString*)organizationName
{
return QToOFString([self qCoreApplication]->organizationName());
}
- (void)setOrganizationName: (OFString*)organizationName
{
[self qCoreApplication]->setOrganizationName(
OFToQString(organizationName));
}
- (void)quit
{
[self qCoreApplication]->quit();
}
- (bool)isQuitLockEnabled
{
return [self qCoreApplication]->isQuitLockEnabled();
}
- (void)setQuitLockEnabled: (bool)quitLockEnabled
{
[self qCoreApplication]->setQuitLockEnabled(quitLockEnabled);
}
- (void)removeNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
{
[self qCoreApplication]->removeNativeEventFilter(filterObject);
}
- (bool)sendEvent: (QtEvent*)event
receiver: (QtObject*)receiver
{
return [self qCoreApplication]->notify(
[receiver qObject], [event qEvent]);
}
@end

22
QtCore/QtEvent.h Normal file
View file

@ -0,0 +1,22 @@
#import <ObjFW/ObjFW.h>
#import "QtOwnershipManaging.h"
#include <QEvent>
@interface QtEvent: OFObject <QtOwnershipManaging>
{
QEvent *_qEvent;
bool _ownsEvent;
}
@property (readonly) QEvent *qEvent;
@property (getter=isAccepted) bool accepted;
@property (readonly, getter=isSpontaneous) bool spontaneous;
@property (readonly) QEvent::Type type;
+ (int)registerEventType: (int)hint;
- initWithQEvent: (QEvent*)qEvent;
- (void)accept;
- (void)ignore;
@end

74
QtCore/QtEvent.mm Normal file
View file

@ -0,0 +1,74 @@
#import "QtEvent.h"
@implementation QtEvent
@synthesize qEvent = _eEvent;
+ (int)registerEventType: (int)hint
{
return QEvent::registerEventType(hint);
}
- init
{
OF_INVALID_INIT_METHOD
}
- initWithQEvent: (QEvent*)qEvent
{
self = [super init];
_qEvent = qEvent;
return self;
}
- (void)dealloc
{
if (_ownsEvent)
delete _qEvent;
[super dealloc];
}
- (void)takeOwnership
{
OF_ENSURE(!_ownsEvent);
_ownsEvent = true;
}
- (void)giveUpOwnership
{
OF_ENSURE(_ownsEvent);
_ownsEvent = false;
}
- (void)accept
{
_qEvent->accept();
}
- (void)ignore
{
_qEvent->ignore();
}
- (bool)isAccepted
{
return _qEvent->isAccepted();
}
- (void)setAccepted: (bool)accepted
{
_qEvent->setAccepted(accepted);
}
- (bool)isSpontaneous
{
return _qEvent->spontaneous();
}
- (QEvent::Type)type
{
return _qEvent->type();
}
@end

60
QtCore/QtObject.h Normal file
View file

@ -0,0 +1,60 @@
#import <ObjFW/ObjFW.h>
#import "QtOwnershipManaging.h"
#include <QObject>
@class QtEvent;
@class QtThread;
@interface QtObject: OFObject <QtOwnershipManaging>
{
QObject *_qObject;
bool _ownsObject;
}
@property (readonly) QObject *qObject;
@property (readonly) const QMetaObject *metaObject;
@property (retain) QtObject *parent;
@property (copy) OFString *objectName;
- initWithQObject: (QObject*)qObject;
- (bool)setBlockSignals: (bool)block;
- (OFArray OF_GENERIC(QtObject*)*)children;
- (QMetaObject::Connection)connectSignal: (OFString*)signal
sender: (QtObject*)sender
method: (OFString*)method
type: (Qt::ConnectionType)type;
- (bool)disconnectSignal: (OFString*)signal
receiver: (QtObject*)receiver
method: (OFString*)method;
- (bool)disconnectAllSignalsForReceiver: (QtObject*)receiver
method: (OFString*)method;
- (void)dumpObjectInfo;
- (void)dumpObjectTree;
- (OFArray OF_GENERIC(OFDataArray*)*)dynamicPropertyNames;
- (bool)handleEvent: (QtEvent*)event;
- (bool)filterEvent: (QtEvent*)event
forObject: (QtObject*)watched;
// MISSING: T findChild(const QString &name = QString(),
// Qt::FindChildOptions options = Qt::FindChildrenRecursively) const;
// MISSING QList<T> findChildren(const QString &name = QString(),
// Qt::FindChildOptions options = Qt::FindChildrenRecursively) const;
// MISSING: QList<T> findChildren(const QRegExp &regExp,
// Qt::FindChildOptions options = Qt::FindChildrenRecursively) const;
- (bool)inheritsClassWithName: (OFString*)className;
- (void)installEventFilter: (QtObject*)filterObj;
- (bool)isWidgetType;
- (bool)isWindowType;
- (void)killTimerWithID: (int)ID;
- (void)moveToThread: (QtThread*)targetThread;
- (QVariant)propertyForName: (OFString*)name;
- (void)removeEventFilter: (QtObject*)obj;
- (bool)setProperty: (QVariant&)value
forName: (OFString*)name;
- (bool)signalsBlocked;
- (int)startTimerWithInterval: (int)interval
type: (Qt::TimerType)type;
- (QtThread*)thread;
- (void)deleteLater;
@end

225
QtCore/QtObject.mm Normal file
View file

@ -0,0 +1,225 @@
#import "QtObject.h"
#import "QtEvent.h"
#import "QtThread.h"
#import "helpers.h"
#include <QVariant>
@implementation QtObject
@synthesize qObject = _qObject;
- init
{
OF_INVALID_INIT_METHOD
}
- initWithQObject: (QObject*)qObject
{
self = [super init];
_qObject = qObject;
return self;
}
- (void)dealloc
{
if (_ownsObject)
delete _qObject;
[super dealloc];
}
- (void)takeOwnership
{
OF_ENSURE(!_ownsObject);
_ownsObject = true;
}
- (void)giveUpOwnership
{
OF_ENSURE(_ownsObject);
_ownsObject = false;
}
- (OFString*)objectName
{
return QToOFString(_qObject->objectName());
}
- (void)setObjectName: (OFString*)objectName
{
_qObject->setObjectName(OFToQString(objectName));
}
- (bool)setBlockSignals: (bool)block
{
return _qObject->blockSignals(block);
}
- (OFArray OF_GENERIC(QtObject*)*)children
{
const QObjectList &qChildren = _qObject->children();
OFMutableArray *children = [OFMutableArray arrayWithCapacity:
qChildren.count()];
void *pool = objc_autoreleasePoolPush();
for (QObject *qChild: qChildren)
[children addObject:
[[[QtObject alloc] initWithQObject: qChild] autorelease]];
objc_autoreleasePoolPop(pool);
return children;
}
- (QMetaObject::Connection)connectSignal: (OFString*)signal
sender: (QtObject*)sender
method: (OFString*)method
type: (Qt::ConnectionType)type
{
return _qObject->connect([sender qObject],
[signal UTF8String], [method UTF8String], type);
}
- (bool)disconnectSignal: (OFString*)signal
receiver: (QtObject*)receiver
method: (OFString*)method
{
return _qObject->disconnect([signal UTF8String], [receiver qObject],
[method UTF8String]);
}
- (bool)disconnectAllSignalsForReceiver: (QtObject*)receiver
method: (OFString*)method
{
return _qObject->disconnect([receiver qObject], [method UTF8String]);
}
- (void)dumpObjectInfo
{
_qObject->dumpObjectInfo();
}
- (void)dumpObjectTree
{
_qObject->dumpObjectTree();
}
- (OFArray OF_GENERIC(OFDataArray*)*)dynamicPropertyNames
{
const QList<QByteArray> &qDynamicPropertyNames =
_qObject->dynamicPropertyNames();
OFMutableArray *dynamicPropertyNames =
[OFMutableArray arrayWithCapacity: qDynamicPropertyNames.count()];
void *pool = objc_autoreleasePoolPush();
for (const QByteArray &qDynamicPropertyName: qDynamicPropertyNames) {
OFDataArray *dynamicPropertyName = [OFDataArray dataArray];
[dynamicPropertyName addItems: qDynamicPropertyName.data()
count: qDynamicPropertyName.count()];
[dynamicPropertyNames addObject: dynamicPropertyName];
}
objc_autoreleasePoolPop(pool);
return dynamicPropertyNames;
}
- (bool)handleEvent: (QtEvent*)event
{
return _qObject->event([event qEvent]);
}
- (bool)filterEvent: (QtEvent*)event
forObject: (QtObject*)watched
{
return _qObject->eventFilter([watched qObject], [event qEvent]);
}
- (bool)inheritsClassWithName: (OFString*)className
{
return _qObject->inherits([className UTF8String]);
}
- (void)installEventFilter: (QtObject*)filterObj
{
_qObject->installEventFilter([filterObj qObject]);
}
- (bool)isWidgetType
{
return _qObject->isWidgetType();
}
- (bool)isWindowType
{
return _qObject->isWindowType();
}
- (void)killTimerWithID: (int)ID
{
_qObject->killTimer(ID);
}
- (const QMetaObject*)metaObject
{
return _qObject->metaObject();
}
- (void)moveToThread: (QtThread*)targetThread
{
_qObject->moveToThread([targetThread qThread]);
}
- (QtObject*)parent
{
return [[[QtObject alloc]
initWithQObject: _qObject->parent()] autorelease];
}
- (void)setParent: (QtObject*)parent
{
_qObject->setParent([parent qObject]);
}
- (QVariant)propertyForName: (OFString*)name
{
return _qObject->property([name UTF8String]);
}
- (void)removeEventFilter: (QtObject*)obj
{
_qObject->removeEventFilter([obj qObject]);
}
- (bool)setProperty: (QVariant&)value
forName: (OFString*)name
{
return _qObject->setProperty([name UTF8String], value);
}
- (bool)signalsBlocked
{
return _qObject->signalsBlocked();
}
- (int)startTimerWithInterval: (int)interval
type: (Qt::TimerType)type
{
return _qObject->startTimer(interval, type);
}
- (QtThread*)thread
{
return [[[QtThread alloc]
initWithQThread: _qObject->thread()] autorelease];
}
- (void)deleteLater
{
OF_ENSURE(!_ownsObject);
_qObject->deleteLater();
}
@end

22
QtCore/QtThread.h Normal file
View file

@ -0,0 +1,22 @@
#import "QtObject.h"
#include <QThread>
@interface QtThread: QtObject
@property (readonly) QThread *qThread;
@property QAbstractEventDispatcher *eventDispatcher;
@property (readonly, getter=isFinished) bool finished;
@property (readonly, getter=isInterruptionRequested) bool interruptionRequested;
@property (readonly, getter=isRunning) bool running;
@property (readonly) int loopLevel;
@property QThread::Priority priority;
@property unsigned int stackSize;
- initWithQThread: (QThread*)qThread;
- (void)exitWithReturnCode: (int)returnCode;
- (void)requestInterruption;
- (bool)waitForMilliseconds: (unsigned long)time;
- (void)quit;
- (void)startWithPriority: (QThread::Priority)priority;
- (void)terminate;
@end

98
QtCore/QtThread.mm Normal file
View file

@ -0,0 +1,98 @@
#import "QtThread.h"
@implementation QtThread: QtObject
- initWithQObject: (QObject*)qObject
{
OF_INVALID_INIT_METHOD
}
- initWithQThread: (QThread*)qThread
{
return [super initWithQObject: qThread];
}
- (QThread*)qThread
{
return qobject_cast<QThread*>(_qObject);
}
- (QAbstractEventDispatcher*)eventDispatcher
{
return [self qThread]->eventDispatcher();
}
- (void)setEventDispatcher: (QAbstractEventDispatcher*)eventDispatcher
{
[self qThread]->setEventDispatcher(eventDispatcher);
}
- (void)exitWithReturnCode: (int)returnCode
{
[self qThread]->exit(returnCode);
}
- (bool)isFinished
{
return [self qThread]->isFinished();
}
- (bool)isInterruptionRequested
{
return [self qThread]->isInterruptionRequested();
}
- (bool)isRunning
{
return [self qThread]->isRunning();
}
- (int)loopLevel
{
return [self qThread]->loopLevel();
}
- (QThread::Priority)priority
{
return [self qThread]->priority();
}
- (void)setPriority: (QThread::Priority)priority
{
[self qThread]->setPriority(priority);
}
- (void)requestInterruption
{
[self qThread]->requestInterruption();
}
- (unsigned int)stackSize
{
return [self qThread]->stackSize();
}
- (void)setStackSize: (unsigned int)stackSize
{
[self qThread]->setStackSize(stackSize);
}
- (bool)waitForMilliseconds: (unsigned long)time
{
return [self qThread]->wait(time);
}
- (void)quit
{
[self qThread]->quit();
}
- (void)startWithPriority: (QThread::Priority)priority
{
[self qThread]->start(priority);
}
- (void)terminate
{
[self qThread]->terminate();
}
@end

21
QtGui/QtGuiApplication.h Normal file
View file

@ -0,0 +1,21 @@
#import "QtCoreApplication.h"
#include <QGuiApplication>
@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 QIcon windowIcon;
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication;
- (double)devicePixelRatio;
- (bool)isSavingSession;
- (bool)isSessionRestored;
- (OFString*)sessionID;
- (OFString*)sessionKey;
@end

110
QtGui/QtGuiApplication.mm Normal file
View file

@ -0,0 +1,110 @@
#import "QtGuiApplication.h"
#import "helpers.h"
#include <QIcon>
@implementation QtGuiApplication
- initWithQCoreApplication: (QCoreApplication*)qCoreApplication
{
OF_INVALID_INIT_METHOD
}
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication
{
return [super initWithQCoreApplication: qGuiApplication];
}
- (QGuiApplication*)qGuiApplication
{
return qobject_cast<QGuiApplication*>(_qObject);
}
- (OFString*)applicationDisplayName
{
return QToOFString([self qGuiApplication]->applicationDisplayName());
}
- (void)setApplicationDisplayName: (OFString*)applicationDisplayName
{
[self qGuiApplication]->setApplicationDisplayName(
OFToQString(applicationDisplayName));
}
- (OFString*)desktopFileName
{
return QToOFString([self qGuiApplication]->desktopFileName());
}
- (void)setDesktopFileName: (OFString*)desktopFileName
{
[self qGuiApplication]->setDesktopFileName(
OFToQString(desktopFileName));
}
- (double)devicePixelRatio
{
return [self qGuiApplication]->devicePixelRatio();
}
- (bool)isSavingSession
{
return [self qGuiApplication]->isSavingSession();
}
- (bool)isSessionRestored
{
return [self qGuiApplication]->isSessionRestored();
}
- (Qt::LayoutDirection)layoutDirection
{
return [self qGuiApplication]->layoutDirection();
}
- (void)setLayoutDirection: (Qt::LayoutDirection)layoutDirection
{
[self qGuiApplication]->setLayoutDirection(layoutDirection);
}
- (OFString*)platformName
{
return QToOFString([self qGuiApplication]->platformName());
}
- (QScreen*)primaryScreen
{
return [self qGuiApplication]->primaryScreen();
}
- (bool)quitOnLastWindowClosed
{
return [self qGuiApplication]->quitOnLastWindowClosed();
}
- (void)setQuitOnLastWindowClosed: (bool)quitOnLastWindowClosed
{
[self qGuiApplication]->setQuitOnLastWindowClosed(
quitOnLastWindowClosed);
}
- (OFString*)sessionID
{
return QToOFString([self qGuiApplication]->sessionId());
}
- (OFString*)sessionKey
{
return QToOFString([self qGuiApplication]->sessionKey());
}
- (QIcon)windowIcon
{
return [self qGuiApplication]->windowIcon();
}
- (void)setWindowIcon: (QIcon)windowIcon
{
[self qGuiApplication]->setWindowIcon(windowIcon);
}
@end

22
QtWidgets/QtApplication.h Normal file
View file

@ -0,0 +1,22 @@
#import "QtGuiApplication.h"
#include <QApplication>
@interface QtApplication: QtGuiApplication
@property (readonly) QApplication *qApplication;
@property bool autoSipEnabled;
@property int cursorFlashTime;
@property int doubleClickInterval;
@property QSize globalStrut;
@property int keyboardInputInterval;
@property int startDragDistance;
@property int startDragTime;
@property (copy) OFString *styleSheet;
@property int wheelScrollLines;
- initWithQApplication: (QApplication*)qApplication;
- (void)aboutQt;
- (bool)autoSipEnabled;
- (void)closeAllWindows;
- (void)setAutoSipEnabled: (bool)enabled;
@end

120
QtWidgets/QtApplication.mm Normal file
View file

@ -0,0 +1,120 @@
#import "QtApplication.h"
#import "helpers.h"
@implementation QtApplication
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication
{
OF_INVALID_INIT_METHOD
}
- initWithQApplication: (QApplication*)qApplication
{
return [super initWithQGuiApplication: qApplication];
}
- (QApplication*)qApplication
{
return qobject_cast<QApplication*>(_qObject);
}
- (bool)autoSipEnabled
{
return [self qApplication]->autoSipEnabled();
}
- (void)setAutoSipEnabled: (bool)autoSipEnabled
{
[self qApplication]->setAutoSipEnabled(autoSipEnabled);
}
- (int)cursorFlashTime
{
return [self qApplication]->cursorFlashTime();
}
- (void)setCursorFlashTime: (int)cursorFlashTime
{
[self qApplication]->setCursorFlashTime(cursorFlashTime);
}
- (int)doubleClickInterval
{
return [self qApplication]->doubleClickInterval();
}
- (void)setDoubleClickInterval: (int)doubleClickInterval
{
[self qApplication]->setDoubleClickInterval(doubleClickInterval);
}
- (QSize)globalStrut
{
return [self qApplication]->globalStrut();
}
- (void)setGlobalStrut: (QSize)globalStrut
{
[self qApplication]->setGlobalStrut(globalStrut);
}
- (int)keyboardInputInterval
{
return [self qApplication]->keyboardInputInterval();
}
- (void)setKeyboardInputInterval: (int)keyboardInputInterval
{
[self qApplication]->setKeyboardInputInterval(keyboardInputInterval);
}
- (int)startDragDistance
{
return [self qApplication]->startDragDistance();
}
- (void)setStartDragDistance: (int)startDragDistance
{
[self qApplication]->setStartDragDistance(startDragDistance);
}
- (int)startDragTime
{
return [self qApplication]->startDragTime();
}
- (void)setStartDragTime: (int)startDragTime
{
[self qApplication]->setStartDragTime(startDragTime);
}
- (OFString*)styleSheet
{
return QToOFString([self qApplication]->styleSheet());
}
- (void)setStyleSheet: (OFString*)styleSheet
{
[self qApplication]->setStyleSheet(OFToQString(styleSheet));
}
- (int)wheelScrollLines
{
return [self qApplication]->wheelScrollLines();
}
- (void)setWheelScrollLines: (int)wheelScrollLines
{
[self qApplication]->setWheelScrollLines(wheelScrollLines);
}
- (void)aboutQt
{
[self qApplication]->aboutQt();
}
- (void)closeAllWindows
{
[self qApplication]->closeAllWindows();
}
@end

View file

@ -0,0 +1,6 @@
#import <ObjFW/ObjFW.h>
@protocol QtOwnershipManaging
- (void)takeOwnership;
- (void)giveUpOwnership;
@end

15
common/helpers.h Normal file
View file

@ -0,0 +1,15 @@
#import <ObjFW/ObjFW.h>
#include <QString>
inline OFString*
QToOFString(const QString &qString)
{
return [OFString stringWithUTF8String: qString.toUtf8()];
}
inline QString
OFToQString(OFString *string)
{
return QString::fromUtf8([string UTF8String]);
}