From dcc0d5e48abaf6a7ffc95c743eb14ac716f3f3e2 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 14 May 2017 02:57:09 +0200 Subject: [PATCH] Declare designated initializers --- src/QtCore/QtChildEvent.h | 2 +- src/QtCore/QtChildEvent.mm | 2 +- src/QtCore/QtCoreApplication.h | 3 ++- src/QtCore/QtEvent.h | 2 +- src/QtCore/QtObject.h | 2 +- src/QtCore/QtThread.h | 2 +- src/QtGui/QtGUIApplication.h | 3 ++- src/QtWidgets/QtAbstractButton.h | 3 ++- src/QtWidgets/QtAction.h | 2 +- src/QtWidgets/QtApplication.h | 2 +- src/QtWidgets/QtPushButton.h | 2 +- src/QtWidgets/QtPushButton.mm | 4 ++-- src/QtWidgets/QtWidget.h | 2 +- 13 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/QtCore/QtChildEvent.h b/src/QtCore/QtChildEvent.h index 58ad43e..5951ad6 100644 --- a/src/QtCore/QtChildEvent.h +++ b/src/QtCore/QtChildEvent.h @@ -32,7 +32,7 @@ @property (readonly, nonatomic, getter=isRemoved) bool removed; - initWithQEvent: (QEvent *)event OF_UNAVAILABLE; -- initWithQChildEvent: (QChildEvent *)qChildEvent; +- initWithQChildEvent: (QChildEvent *)qChildEvent OF_DESIGNATED_INITIALIZER; - initWithType: (QChildEvent::Type)type child: (QtObject *)child; @end diff --git a/src/QtCore/QtChildEvent.mm b/src/QtCore/QtChildEvent.mm index 9e44cd9..ab1d7cd 100644 --- a/src/QtCore/QtChildEvent.mm +++ b/src/QtCore/QtChildEvent.mm @@ -48,7 +48,7 @@ using ObjQt::toQt; return self; } catch (const std::bad_alloc &e) { - self = [super initWithQEvent: NULL]; + self = [self initWithQChildEvent: NULL]; [self release]; throw; } diff --git a/src/QtCore/QtCoreApplication.h b/src/QtCore/QtCoreApplication.h index 8b78901..250e7e0 100644 --- a/src/QtCore/QtCoreApplication.h +++ b/src/QtCore/QtCoreApplication.h @@ -31,7 +31,8 @@ @property (nonatomic, getter=isQuitLockEnabled) bool quitLockEnabled; - initWithQObject: (QObject *)qObject OF_UNAVAILABLE; -- initWithQCoreApplication: (QCoreApplication *)qCoreApplication; +- initWithQCoreApplication: (QCoreApplication *)qCoreApplication + OF_DESIGNATED_INITIALIZER; - (void)installNativeEventFilter: (QAbstractNativeEventFilter *)filterObject; - (void)quit; - (void)removeNativeEventFilter: (QAbstractNativeEventFilter *)filterObject; diff --git a/src/QtCore/QtEvent.h b/src/QtCore/QtEvent.h index b1a9fa3..7b6c18e 100644 --- a/src/QtCore/QtEvent.h +++ b/src/QtCore/QtEvent.h @@ -39,7 +39,7 @@ + (int)registerEventType: (int)hint; - init OF_UNAVAILABLE; -- initWithQEvent: (QEvent *)qEvent; +- initWithQEvent: (QEvent *)qEvent OF_DESIGNATED_INITIALIZER; - (void)accept; - (void)ignore; @end diff --git a/src/QtCore/QtObject.h b/src/QtCore/QtObject.h index 3126671..f7296f1 100644 --- a/src/QtCore/QtObject.h +++ b/src/QtCore/QtObject.h @@ -41,7 +41,7 @@ @property (nonatomic, copy) OFString *objectName; - init OF_UNAVAILABLE; -- initWithQObject: (QObject *)qObject; +- initWithQObject: (QObject *)qObject OF_DESIGNATED_INITIALIZER; - (bool)setBlockSignals: (bool)block; - (OFArray OF_GENERIC(QtObject *) *)children; - (QMetaObject::Connection)connectSignal: (OFString *)signal diff --git a/src/QtCore/QtThread.h b/src/QtCore/QtThread.h index fcdad4d..5c00093 100644 --- a/src/QtCore/QtThread.h +++ b/src/QtCore/QtThread.h @@ -36,7 +36,7 @@ @property (nonatomic) unsigned int stackSize; - initWithQObject: (QObject *)qObject OF_UNAVAILABLE; -- initWithQThread: (QThread *)qThread; +- initWithQThread: (QThread *)qThread OF_DESIGNATED_INITIALIZER; - (void)exitWithReturnCode: (int)returnCode; - (void)requestInterruption; - (bool)waitForMilliseconds: (unsigned long)time; diff --git a/src/QtGui/QtGUIApplication.h b/src/QtGui/QtGUIApplication.h index 15e7454..df5057e 100644 --- a/src/QtGui/QtGUIApplication.h +++ b/src/QtGui/QtGUIApplication.h @@ -37,7 +37,8 @@ @property (nonatomic) QIcon windowIcon; - initWithQCoreApplication: (QCoreApplication *)qCoreApplication OF_UNAVAILABLE; -- initWithQGuiApplication: (QGuiApplication *)qGuiApplication; +- initWithQGuiApplication: (QGuiApplication *)qGuiApplication + OF_DESIGNATED_INITIALIZER; - (double)devicePixelRatio; - (bool)isSavingSession; - (bool)isSessionRestored; diff --git a/src/QtWidgets/QtAbstractButton.h b/src/QtWidgets/QtAbstractButton.h index 4e4533a..91f8b05 100644 --- a/src/QtWidgets/QtAbstractButton.h +++ b/src/QtWidgets/QtAbstractButton.h @@ -39,7 +39,8 @@ @property (nonatomic, copy) OFString *text; - initWithQWidget: (QWidget *)qWidget OF_UNAVAILABLE; -- initWithQAbstractButton: (QAbstractButton *)qAbstractButton; +- initWithQAbstractButton: (QAbstractButton *)qAbstractButton + OF_DESIGNATED_INITIALIZER; - (QButtonGroup *)group; @end diff --git a/src/QtWidgets/QtAction.h b/src/QtWidgets/QtAction.h index 35060f6..36e5d25 100644 --- a/src/QtWidgets/QtAction.h +++ b/src/QtWidgets/QtAction.h @@ -47,7 +47,7 @@ @property (nonatomic, copy) OFString *whatsThis; - initWithQObject: (QObject *)qObject OF_UNAVAILABLE; -- initWithQAction: (QAction *)qAction; +- initWithQAction: (QAction *)qAction OF_DESIGNATED_INITIALIZER; - (QActionGroup *)actionGroup; - (void)activate: (QAction::ActionEvent)event; - (QList)associatedGraphicsWidgets; diff --git a/src/QtWidgets/QtApplication.h b/src/QtWidgets/QtApplication.h index 4943376..39f571f 100644 --- a/src/QtWidgets/QtApplication.h +++ b/src/QtWidgets/QtApplication.h @@ -37,7 +37,7 @@ @property (nonatomic) int wheelScrollLines; - initWithQGuiApplication: (QGuiApplication *)qGuiApplication OF_UNAVAILABLE; -- initWithQApplication: (QApplication *)qApplication; +- initWithQApplication: (QApplication *)qApplication OF_DESIGNATED_INITIALIZER; - (void)aboutQt; - (void)closeAllWindows; @end diff --git a/src/QtWidgets/QtPushButton.h b/src/QtWidgets/QtPushButton.h index eeeaaab..e189dc5 100644 --- a/src/QtWidgets/QtPushButton.h +++ b/src/QtWidgets/QtPushButton.h @@ -34,7 +34,7 @@ @property (nonatomic, getter=isFlat) bool flat; - initWithQAbstractButton: (QAbstractButton *)qAbstractButton OF_UNAVAILABLE; -- initWithQPushButton: (QPushButton *)qPushButton; +- initWithQPushButton: (QPushButton *)qPushButton OF_DESIGNATED_INITIALIZER; - initWithText: (OFString *)text; - initWithIcon: (QIcon)icon text: (OFString *)text; diff --git a/src/QtWidgets/QtPushButton.mm b/src/QtWidgets/QtPushButton.mm index afaba47..b722d3b 100644 --- a/src/QtWidgets/QtPushButton.mm +++ b/src/QtWidgets/QtPushButton.mm @@ -50,7 +50,7 @@ using ObjQt::toQt; return self; } catch (const std::bad_alloc &e) { - self = [super initWithQAbstractButton: NULL]; + self = [self initWithQPushButton: NULL]; [self release]; throw; } @@ -67,7 +67,7 @@ using ObjQt::toQt; return self; } catch (const std::bad_alloc &e) { - self = [super initWithQAbstractButton: NULL]; + self = [self initWithQPushButton: NULL]; [self release]; throw; } diff --git a/src/QtWidgets/QtWidget.h b/src/QtWidgets/QtWidget.h index 126ad10..2375f36 100644 --- a/src/QtWidgets/QtWidget.h +++ b/src/QtWidgets/QtWidget.h @@ -87,7 +87,7 @@ @property (readonly, nonatomic) int y; - initWithQObject: (QObject *)qObject OF_UNAVAILABLE; -- initWithQWidget: (QWidget *)qWidget; +- initWithQWidget: (QWidget *)qWidget OF_DESIGNATED_INITIALIZER; - (OFArray OF_GENERIC(QtAction *) *)actions; - (void)activateWindow; - (void)addAction: (QtAction *)action;