From 65d8629a0c881c8a1cef6588182e959e1325ea7b Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 26 Apr 2024 22:40:51 +0300 Subject: [PATCH] drop support for some properties annotations, revisioned properties and methods Signed-off-by: Ivailo Monev --- CMakeLists.txt | 1 - package/freebsd/pkg-plist | 1 - scripts/incfsck.py | 1 - scripts/namefsck.py | 1 - src/core/kernel/qmetaobject.cpp | 210 +----------------- src/core/kernel/qmetaobject.h | 9 - src/core/kernel/qmetaobject_p.h | 20 +- src/core/kernel/qobjectdefs.h | 7 - src/dbus/qdbusmetaobject.cpp | 2 +- src/gui/dialogs/qfiledialog.h | 7 +- src/gui/graphicsview/qgraphicsitem.h | 14 +- src/gui/itemviews/qitemdelegate.cpp | 27 +-- src/gui/itemviews/qitemeditorfactory.cpp | 80 +------ src/gui/itemviews/qitemeditorfactory.h | 14 -- src/gui/itemviews/qlistwidget.h | 2 +- src/gui/itemviews/qstyleditemdelegate.cpp | 27 +-- src/gui/kernel/qaction.h | 2 +- src/gui/kernel/qwidget.h | 26 +-- src/gui/text/qtextcontrol_p.h | 2 +- src/gui/text/qtextdocument.h | 2 +- src/gui/widgets/qabstractbutton.h | 4 +- src/gui/widgets/qabstractslider.h | 4 +- src/gui/widgets/qcombobox.h | 6 +- src/gui/widgets/qcommandlinkbutton.h | 2 +- src/gui/widgets/qdatetimeedit.h | 2 +- src/gui/widgets/qdockwidget.h | 2 +- src/gui/widgets/qframe.h | 2 +- src/gui/widgets/qgroupbox.h | 2 +- src/gui/widgets/qlineedit.h | 4 +- src/gui/widgets/qplaintextedit.h | 2 +- src/gui/widgets/qspinbox.h | 4 +- src/gui/widgets/qtextbrowser.h | 4 +- src/gui/widgets/qtextedit.h | 4 +- src/gui/widgets/qtoolbar.h | 15 +- src/tools/moc/generator.cpp | 135 ----------- src/tools/moc/generator.h | 1 - src/tools/moc/keywords.cpp | 20 +- src/tools/moc/moc.cpp | 138 +----------- src/tools/moc/moc.h | 25 +-- src/tools/moc/util/generate_keywords.cpp | 1 - .../qdbusmetaobject/tst_qdbusmetaobject.cpp | 4 - tests/auto/qmetaobject/tst_qmetaobject.cpp | 34 --- 42 files changed, 104 insertions(+), 766 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da5571b3a..b78aaf4e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -619,7 +619,6 @@ katie_generate_obsolete(QSizeF QtCore qsize.h) katie_generate_obsolete(QSpacerItem QtGui qlayoutitem.h) katie_generate_obsolete(QSplitterHandle QtGui qsplitter.h) katie_generate_obsolete(QSpontaneKeyEvent QtTest qtestspontaneevent.h) -katie_generate_obsolete(QStandardItemEditorCreator QtGui qitemeditorfactory.h) katie_generate_obsolete(QStandardItem QtGui qstandarditemmodel.h) katie_generate_obsolete(QStatusTipEvent QtGui qevent.h) katie_generate_obsolete(QStringListIterator QtCore qstringlist.h) diff --git a/package/freebsd/pkg-plist b/package/freebsd/pkg-plist index bff94df2d..36122c1fa 100644 --- a/package/freebsd/pkg-plist +++ b/package/freebsd/pkg-plist @@ -502,7 +502,6 @@ include/katie/QtGui/QSplitterHandle include/katie/QtGui/QStackedLayout include/katie/QtGui/QStackedWidget include/katie/QtGui/QStandardItem -include/katie/QtGui/QStandardItemEditorCreator include/katie/QtGui/QStandardItemModel include/katie/QtGui/QStatusBar include/katie/QtGui/QStatusTipEvent diff --git a/scripts/incfsck.py b/scripts/incfsck.py index 5725f892f..5b71e2bc6 100755 --- a/scripts/incfsck.py +++ b/scripts/incfsck.py @@ -177,7 +177,6 @@ incmap = { 'QSpacerItem': 'qlayoutitem.h', 'QSplitterHandle': 'qsplitter.h', 'QStandardItem': 'qstandarditemmodel.h', - 'QStandardItemEditorCreator': 'qitemeditorfactory.h', 'QStatusTipEvent': 'qevent.h', 'QStyleHintReturn': 'qstyleoption.h', 'QStyleHintReturnMask': 'qstyleoption.h', diff --git a/scripts/namefsck.py b/scripts/namefsck.py index ea6ec9374..082352189 100755 --- a/scripts/namefsck.py +++ b/scripts/namefsck.py @@ -386,7 +386,6 @@ classlist = [ "QStackedLayout", "QStackedWidget", "QStandardItem", - "QStandardItemEditorCreator", "QStandardItemModel", "QStandardPaths", "QStatusBar", diff --git a/src/core/kernel/qmetaobject.cpp b/src/core/kernel/qmetaobject.cpp index 53142a9ba..8e0c553da 100644 --- a/src/core/kernel/qmetaobject.cpp +++ b/src/core/kernel/qmetaobject.cpp @@ -99,11 +99,7 @@ QT_BEGIN_NAMESPACE \value ReadProperty \value WriteProperty \value ResetProperty - \value QueryPropertyDesignable \value QueryPropertyScriptable - \value QueryPropertyStored - \value QueryPropertyEditable - \value QueryPropertyUser \value CreateInstance */ @@ -784,24 +780,6 @@ QMetaProperty QMetaObject::property(int index) const return result; } -/*! - \since 4.2 - - Returns the property that has the \c USER flag set to true. - - \sa QMetaProperty::isUser() -*/ -QMetaProperty QMetaObject::userProperty() const -{ - const int propCount = propertyCount(); - for (int i = propCount - 1; i >= 0; --i) { - const QMetaProperty prop = property(i); - if (prop.isUser()) - return prop; - } - return QMetaProperty(); -} - /*! Returns the meta-data for the item of class information with the given \a index. @@ -1343,25 +1321,6 @@ int QMetaMethod::methodIndex() const return ((handle - priv(mobj->d.data)->methodData) / 5) + mobj->methodOffset(); } -/*! - \internal - - Returns the method revision if one was - specified by Q_REVISION, otherwise returns 0. - */ -int QMetaMethod::revision() const -{ - if (!mobj) - return 0; - if ((QMetaMethod::Access)(mobj->d.data[handle + 4] & MethodRevisioned)) { - int offset = priv(mobj->d.data)->methodData - + priv(mobj->d.data)->methodCount * 5 - + (handle - priv(mobj->d.data)->methodData) / 5; - return mobj->d.data[offset]; - } - return 0; -} - /*! Returns the access specification of this method (private, protected, or public). @@ -1968,8 +1927,8 @@ inline static QByteArray qualifiedName(const QMetaEnum &e) \section1 Property Meta-Data A property has a name() and a type(), as well as various - attributes that specify its behavior: isReadable(), isWritable(), - isDesignable(), isScriptable(), and isStored(). + attributes that specify its behavior: isReadable(), isWritable() + and isScriptable(). If the property is an enumeration, isEnumType() returns true; if the property is an enumeration that is also a flag (i.e. its values @@ -2379,35 +2338,6 @@ int QMetaProperty::notifySignalIndex() const } } -/*! - \internal - - Returns the property revision if one was - specified by REVISION, otherwise returns 0. - */ -int QMetaProperty::revision() const -{ - if (!mobj) - return 0; - int flags = mobj->d.data[handle + 2]; - if (flags & Revisioned) { - int offset = priv(mobj->d.data)->propertyData + - priv(mobj->d.data)->propertyCount * 3 + idx; - // Revision data is placed after NOTIFY data, if present. - // Iterate through properties to discover whether we have NOTIFY signals. - for (int i = 0; i < priv(mobj->d.data)->propertyCount; ++i) { - int handle = priv(mobj->d.data)->propertyData + 3*i; - if (mobj->d.data[handle + 2] & Notify) { - offset += priv(mobj->d.data)->propertyCount; - break; - } - } - return mobj->d.data[offset]; - } else { - return 0; - } -} - /*! Returns true if this property is writable; otherwise returns false. @@ -2422,33 +2352,6 @@ bool QMetaProperty::isWritable() const return flags & Writable; } - -/*! - Returns true if this property is designable for the given \a object; - otherwise returns false. - - If no \a object is given, the function returns false if the - \c{Q_PROPERTY()}'s \c DESIGNABLE attribute is false; otherwise - returns true (if the attribute is true or is a function or expression). - - \sa isScriptable(), isStored() -*/ -bool QMetaProperty::isDesignable(const QObject *object) const -{ - if (!mobj) - return false; - int flags = mobj->d.data[handle + 2]; - bool b = flags & Designable; - if (object) { - void *argv[] = { &b }; - QMetaObject::metacall(const_cast(object), QMetaObject::QueryPropertyDesignable, - idx + mobj->propertyOffset(), argv); - } - return b; - - -} - /*! Returns true if the property is scriptable for the given \a object; otherwise returns false. @@ -2456,8 +2359,6 @@ bool QMetaProperty::isDesignable(const QObject *object) const If no \a object is given, the function returns false if the \c{Q_PROPERTY()}'s \c SCRIPTABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression). - - \sa isDesignable(), isStored() */ bool QMetaProperty::isScriptable(const QObject *object) const { @@ -2473,113 +2374,6 @@ bool QMetaProperty::isScriptable(const QObject *object) const return b; } -/*! - Returns true if the property is stored for \a object; otherwise returns - false. - - If no \a object is given, the function returns false if the - \c{Q_PROPERTY()}'s \c STORED attribute is false; otherwise returns - true (if the attribute is true or is a function or expression). - - \sa isDesignable(), isScriptable() -*/ -bool QMetaProperty::isStored(const QObject *object) const -{ - if (!mobj) - return false; - int flags = mobj->d.data[handle + 2]; - bool b = flags & Stored; - if (object) { - void *argv[] = { &b }; - QMetaObject::metacall(const_cast(object), QMetaObject::QueryPropertyStored, - idx + mobj->propertyOffset(), argv); - } - return b; -} - -/*! - Returns true if this property is designated as the \c USER - property, i.e., the one that the user can edit for \a object or - that is significant in some other way. Otherwise it returns - false. e.g., the \c text property is the \c USER editable property - of a QLineEdit. - - If \a object is null, the function returns false if the \c - {Q_PROPERTY()}'s \c USER attribute is false. Otherwise it returns - true. - - \sa QMetaObject::userProperty(), isDesignable(), isScriptable() -*/ -bool QMetaProperty::isUser(const QObject *object) const -{ - if (!mobj) - return false; - int flags = mobj->d.data[handle + 2]; - bool b = flags & User; - if (object) { - void *argv[] = { &b }; - QMetaObject::metacall(const_cast(object), QMetaObject::QueryPropertyUser, - idx + mobj->propertyOffset(), argv); - } - return b; -} - -/*! - \since 4.6 - Returns true if the property is constant; otherwise returns false. - - A property is constant if the \c{Q_PROPERTY()}'s \c CONSTANT attribute - is set. -*/ -bool QMetaProperty::isConstant() const -{ - if (!mobj) - return false; - int flags = mobj->d.data[handle + 2]; - return flags & Constant; -} - -/*! - \since 4.6 - Returns true if the property is final; otherwise returns false. - - A property is final if the \c{Q_PROPERTY()}'s \c FINAL attribute - is set. -*/ -bool QMetaProperty::isFinal() const -{ - if (!mobj) - return false; - int flags = mobj->d.data[handle + 2]; - return flags & Final; -} - -/*! - \obsolete - - Returns true if the property is editable for the given \a object; - otherwise returns false. - - If no \a object is given, the function returns false if the - \c{Q_PROPERTY()}'s \c EDITABLE attribute is false; otherwise returns - true (if the attribute is true or is a function or expression). - - \sa isDesignable(), isScriptable(), isStored() -*/ -bool QMetaProperty::isEditable(const QObject *object) const -{ - if (!mobj) - return false; - int flags = mobj->d.data[handle + 2]; - bool b = flags & Editable; - if (object) { - void *argv[] = { &b }; - QMetaObject::metacall(const_cast(object), QMetaObject::QueryPropertyEditable, - idx + mobj->propertyOffset(), argv); - } - return b; -} - /*! \class QMetaClassInfo diff --git a/src/core/kernel/qmetaobject.h b/src/core/kernel/qmetaobject.h index bf8418002..d63c7c14b 100644 --- a/src/core/kernel/qmetaobject.h +++ b/src/core/kernel/qmetaobject.h @@ -45,7 +45,6 @@ public: enum Attributes { Cloned = 0x1, Scriptable = 0x2 }; int attributes() const; int methodIndex() const; - int revision() const; inline const QMetaObject *enclosingMetaObject() const { return mobj; } @@ -162,13 +161,7 @@ public: bool isReadable() const; bool isWritable() const; bool isResettable() const; - bool isDesignable(const QObject *obj = nullptr) const; bool isScriptable(const QObject *obj = nullptr) const; - bool isStored(const QObject *obj = nullptr) const; - bool isEditable(const QObject *obj = nullptr) const; - bool isUser(const QObject *obj = nullptr) const; - bool isConstant() const; - bool isFinal() const; bool isFlagType() const; bool isEnumType() const; @@ -178,8 +171,6 @@ public: QMetaMethod notifySignal() const; int notifySignalIndex() const; - int revision() const; - QVariant read(const QObject *obj) const; bool write(QObject *obj, const QVariant &value) const; bool reset(QObject *obj) const; diff --git a/src/core/kernel/qmetaobject_p.h b/src/core/kernel/qmetaobject_p.h index 5f7f364ae..b375e09cf 100644 --- a/src/core/kernel/qmetaobject_p.h +++ b/src/core/kernel/qmetaobject_p.h @@ -54,20 +54,9 @@ enum PropertyFlags { EnumOrFlag = 0x00000008, StdCppSet = 0x00000100, // Override = 0x00000200, - Constant = 0x00000400, - Final = 0x00000800, - Designable = 0x00001000, - ResolveDesignable = 0x00002000, - Scriptable = 0x00004000, - ResolveScriptable = 0x00008000, - Stored = 0x00010000, - ResolveStored = 0x00020000, - Editable = 0x00040000, - ResolveEditable = 0x00080000, - User = 0x00100000, - ResolveUser = 0x00200000, - Notify = 0x00400000, - Revisioned = 0x00800000 + Scriptable = 0x00000400, + ResolveScriptable = 0x00000800, + Notify = 0x00001000, }; enum MethodFlags { @@ -83,8 +72,7 @@ enum MethodFlags { MethodTypeMask = 0x0c, MethodCloned = 0x10, - MethodScriptable = 0x20, - MethodRevisioned = 0x40 + MethodScriptable = 0x20 }; enum MetaObjectFlags { diff --git a/src/core/kernel/qobjectdefs.h b/src/core/kernel/qobjectdefs.h index f9a530534..55ee062a9 100644 --- a/src/core/kernel/qobjectdefs.h +++ b/src/core/kernel/qobjectdefs.h @@ -51,7 +51,6 @@ class QString; #define Q_INTERFACES(x) #define Q_PROPERTY(text) #define Q_PRIVATE_PROPERTY(d, text) -#define Q_REVISION(v) #define Q_OVERRIDE(text) #define Q_ENUMS(x) #define Q_FLAGS(x) @@ -119,7 +118,6 @@ private: #define Q_INTERFACES(x) Q_INTERFACES(x) #define Q_PROPERTY(text) Q_PROPERTY(text) #define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text) -#define Q_REVISION(v) Q_REVISION(v) #define Q_OVERRIDE(text) Q_OVERRIDE(text) #define Q_ENUMS(x) Q_ENUMS(x) #define Q_FLAGS(x) Q_FLAGS(x) @@ -234,7 +232,6 @@ struct Q_CORE_EXPORT QMetaObject QMetaEnum enumerator(int index) const; QMetaProperty property(int index) const; QMetaClassInfo classInfo(int index) const; - QMetaProperty userProperty() const; static bool checkConnectArgs(const char *signal, const char *method); static QByteArray normalizedSignature(const char *method); @@ -336,11 +333,7 @@ struct Q_CORE_EXPORT QMetaObject ReadProperty, WriteProperty, ResetProperty, - QueryPropertyDesignable, QueryPropertyScriptable, - QueryPropertyStored, - QueryPropertyEditable, - QueryPropertyUser, CreateInstance }; diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 78eab8a64..6e867e3a4 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -312,7 +312,7 @@ void QDBusMetaObjectGenerator::parseProperties() mp.typeName = type.name; // build the flags: - mp.flags = StdCppSet | Scriptable | Stored | Designable; + mp.flags = StdCppSet | Scriptable; if (p.access != QDBusIntrospection::Property::Write) mp.flags |= Readable; if (p.access != QDBusIntrospection::Property::Read) diff --git a/src/gui/dialogs/qfiledialog.h b/src/gui/dialogs/qfiledialog.h index f28589f70..63e8e9fb9 100644 --- a/src/gui/dialogs/qfiledialog.h +++ b/src/gui/dialogs/qfiledialog.h @@ -49,11 +49,10 @@ class Q_GUI_EXPORT QFileDialog : public QDialog Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) Q_PROPERTY(FileMode fileMode READ fileMode WRITE setFileMode) Q_PROPERTY(AcceptMode acceptMode READ acceptMode WRITE setAcceptMode) - Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE false) - Q_PROPERTY(bool confirmOverwrite READ confirmOverwrite WRITE setConfirmOverwrite DESIGNABLE false) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool confirmOverwrite READ confirmOverwrite WRITE setConfirmOverwrite) Q_PROPERTY(QString defaultSuffix READ defaultSuffix WRITE setDefaultSuffix) - Q_PROPERTY(bool nameFilterDetailsVisible READ isNameFilterDetailsVisible - WRITE setNameFilterDetailsVisible DESIGNABLE false) + Q_PROPERTY(bool nameFilterDetailsVisible READ isNameFilterDetailsVisible WRITE setNameFilterDetailsVisible) Q_PROPERTY(Options options READ options WRITE setOptions) public: diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index af36cd952..c2899ceed 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -482,14 +482,14 @@ inline QRectF QGraphicsItem::mapRectFromScene(qreal ax, qreal ay, qreal w, qreal class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem { Q_OBJECT - Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false) - Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL) + Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged) + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) - Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) - Q_PROPERTY(QPointF pos READ pos WRITE setPos FINAL) - Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) - Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL) - Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged FINAL) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(QPointF pos READ pos WRITE setPos) + Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) + Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) + Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged) Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index a869e610d..d23f2d64b 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -501,27 +501,9 @@ void QItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) con #else Q_D(const QItemDelegate); QVariant v = index.data(Qt::EditRole); - QByteArray n = editor->metaObject()->userProperty().name(); - - // ### Qt 5: remove - // A work-around for missing "USER true" in qdatetimeedit.h for - // QTimeEdit's time property and QDateEdit's date property. - // It only triggers if the default user property "dateTime" is - // reported for QTimeEdit and QDateEdit. - if (n == "dateTime") { - if (editor->inherits("QTimeEdit")) - n = "time"; - else if (editor->inherits("QDateEdit")) - n = "date"; - } - - // ### Qt 5: give QComboBox a USER property - if (n.isEmpty() && editor->inherits("QComboBox")) - n = d->editorFactory()->valuePropertyName(static_cast(v.userType())); + QByteArray n = d->editorFactory()->valuePropertyName(v.type()); if (!n.isEmpty()) { - if (!v.isValid()) - v = QVariant(editor->property(n).userType(), (const void *)0); - editor->setProperty(n, v); + editor->setProperty(n, editor->property(n)); } #endif } @@ -549,10 +531,7 @@ void QItemDelegate::setModelData(QWidget *editor, Q_D(const QItemDelegate); Q_ASSERT(model); Q_ASSERT(editor); - QByteArray n = editor->metaObject()->userProperty().name(); - if (n.isEmpty()) - n = d->editorFactory()->valuePropertyName( - static_cast(model->data(index, Qt::EditRole).userType())); + QByteArray n = d->editorFactory()->valuePropertyName(model->data(index, Qt::EditRole).type()); if (!n.isEmpty()) model->setData(index, editor->property(n), Qt::EditRole); #endif diff --git a/src/gui/itemviews/qitemeditorfactory.cpp b/src/gui/itemviews/qitemeditorfactory.cpp index f7357b4d2..959db9c31 100644 --- a/src/gui/itemviews/qitemeditorfactory.cpp +++ b/src/gui/itemviews/qitemeditorfactory.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE class QBooleanComboBox : public QComboBox { Q_OBJECT - Q_PROPERTY(bool value READ value WRITE setValue USER true) + Q_PROPERTY(bool value READ value WRITE setValue) public: QBooleanComboBox(QWidget *parent); @@ -311,20 +311,15 @@ void QItemEditorFactory::setDefaultFactory(QItemEditorFactory *factory) An editor should provide a user property for the data it edits. QItemDelagates can then access the property using Qt's \l{Meta-Object System}{meta-object system} to set and retrieve the - editing data. A property is set as the user property with the USER - keyword: + editing data. - \snippet doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp 0 + The editor must return the name of the property from valuePropertyName(); + delegates will then use the name to access the property. - If the editor does not provide a user property, it must return the - name of the property from valuePropertyName(); delegates will then - use the name to access the property. If a user property exists, - item delegates will not call valuePropertyName(). - - QStandardItemEditorCreator is a convenience template class that can be used + QItemEditorCreator is a convenience template class that can be used to register widgets without the need to subclass QItemEditorCreatorBase. - \sa QStandardItemEditorCreator, QItemEditorFactory, + \sa QItemEditorCreator, QItemEditorFactory, {Model/View Programming}, {Color Editor Factory Example} */ @@ -362,14 +357,14 @@ void QItemEditorFactory::setDefaultFactory(QItemEditorFactory *factory) override this behavior by reimplementing QAbstractItemDelegate::setModelData() and QAbstractItemDelegate::setEditorData(). - \sa QMetaObject::userProperty(), QItemEditorFactory::registerEditor() + \sa QMetaObject::property(), QItemEditorFactory::registerEditor() */ /*! \class QItemEditorCreator \brief The QItemEditorCreator class makes it possible to create - item editor creator bases without subclassing - QItemEditorCreatorBase. + item editor creator bases without subclassing + QItemEditorCreatorBase. \since 4.2 \ingroup model-view @@ -383,13 +378,9 @@ void QItemEditorFactory::setDefaultFactory(QItemEditorFactory *factory) The constructor takes the name of the property that contains the editing data. QItemDelegate can then access the property by name - when it sets and retrieves editing data. Only use this class if - your editor does not define a user property (using the USER - keyword in the Q_PROPERTY macro). If the widget has a user - property, you should use QStandardItemEditorCreator instead. + when it sets and retrieves editing data. - \sa QItemEditorCreatorBase, QStandardItemEditorCreator, - QItemEditorFactory, {Color Editor Factory Example} + \sa QItemEditorCreatorBase, QItemEditorFactory, {Color Editor Factory Example} */ /*! @@ -414,55 +405,6 @@ void QItemEditorFactory::setDefaultFactory(QItemEditorFactory *factory) \reimp */ -/*! - \class QStandardItemEditorCreator - - \brief The QStandardItemEditorCreator class provides the - possibility to register widgets without having to subclass - QItemEditorCreatorBase. - - \since 4.2 - \ingroup model-view - - This convenience template class makes it possible to register widgets without - having to subclass QItemEditorCreatorBase. - - Example: - - \snippet doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp 2 - - Setting the \c editorFactory created above in an item delegate via - QItemDelegate::setItemEditorFactory() makes sure that all values of type - QVariant::DateTime will be edited in \c{MyFancyDateTimeEdit}. - - The editor must provide a user property that will contain the - editing data. The property is used by \l{QItemDelegate}s to set - and retrieve the data (using Qt's \l{Meta-Object - System}{meta-object system}). You set the user property with - the USER keyword: - - \snippet doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp 3 - - \sa QItemEditorCreatorBase, QItemEditorCreator, - QItemEditorFactory, QItemDelegate, {Color Editor Factory Example} -*/ - -/*! - \fn QStandardItemEditorCreator::QStandardItemEditorCreator() - - Constructs an editor creator object. -*/ - -/*! - \fn QWidget *QStandardItemEditorCreator::createWidget(QWidget *parent) const - \reimp -*/ - -/*! - \fn QByteArray QStandardItemEditorCreator::valuePropertyName() const - \reimp -*/ - #ifndef QT_NO_LINEEDIT QExpandingLineEdit::QExpandingLineEdit(QWidget *parent) diff --git a/src/gui/itemviews/qitemeditorfactory.h b/src/gui/itemviews/qitemeditorfactory.h index cfa2387f0..94a9c8a19 100644 --- a/src/gui/itemviews/qitemeditorfactory.h +++ b/src/gui/itemviews/qitemeditorfactory.h @@ -56,20 +56,6 @@ private: QByteArray propertyName; }; -template -class QStandardItemEditorCreator: public QItemEditorCreatorBase -{ -public: - inline QStandardItemEditorCreator() - : propertyName(T::staticMetaObject.userProperty().name()) - {} - inline QWidget *createWidget(QWidget *parent) const { return new T(parent); } - inline QByteArray valuePropertyName() const { return propertyName; } - -private: - QByteArray propertyName; -}; - template Q_INLINE_TEMPLATE QItemEditorCreator::QItemEditorCreator(const QByteArray &avaluePropertyName) diff --git a/src/gui/itemviews/qlistwidget.h b/src/gui/itemviews/qlistwidget.h index b3d3e6fb1..9b27d3862 100644 --- a/src/gui/itemviews/qlistwidget.h +++ b/src/gui/itemviews/qlistwidget.h @@ -169,7 +169,7 @@ class Q_GUI_EXPORT QListWidget : public QListView { Q_OBJECT Q_PROPERTY(int count READ count) - Q_PROPERTY(int currentRow READ currentRow WRITE setCurrentRow NOTIFY currentRowChanged USER true) + Q_PROPERTY(int currentRow READ currentRow WRITE setCurrentRow NOTIFY currentRowChanged) Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled) friend class QListWidgetItem; diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp index c44012a76..0ae2ef979 100644 --- a/src/gui/itemviews/qstyleditemdelegate.cpp +++ b/src/gui/itemviews/qstyleditemdelegate.cpp @@ -449,27 +449,9 @@ void QStyledItemDelegate::setEditorData(QWidget *editor, const QModelIndex &inde #else Q_D(const QStyledItemDelegate); QVariant v = index.data(Qt::EditRole); - QByteArray n = editor->metaObject()->userProperty().name(); - - // ### Qt 5: remove - // A work-around for missing "USER true" in qdatetimeedit.h for - // QTimeEdit's time property and QDateEdit's date property. - // It only triggers if the default user property "dateTime" is - // reported for QTimeEdit and QDateEdit. - if (n == "dateTime") { - if (editor->inherits("QTimeEdit")) - n = "time"; - else if (editor->inherits("QDateEdit")) - n = "date"; - } - - // ### Qt 5: give QComboBox a USER property - if (n.isEmpty() && editor->inherits("QComboBox")) - n = d->editorFactory()->valuePropertyName(static_cast(v.userType())); + QByteArray n = d->editorFactory()->valuePropertyName(v.type()); if (!n.isEmpty()) { - if (!v.isValid()) - v = QVariant(editor->property(n).userType(), (const void *)0); - editor->setProperty(n, v); + editor->setProperty(n, editor->property(n)); } #endif } @@ -496,10 +478,7 @@ void QStyledItemDelegate::setModelData(QWidget *editor, Q_D(const QStyledItemDelegate); Q_ASSERT(model); Q_ASSERT(editor); - QByteArray n = editor->metaObject()->userProperty().name(); - if (n.isEmpty()) - n = d->editorFactory()->valuePropertyName( - static_cast(model->data(index, Qt::EditRole).userType())); + QByteArray n = d->editorFactory()->valuePropertyName(model->data(index, Qt::EditRole).type()); if (!n.isEmpty()) model->setData(index, editor->property(n), Qt::EditRole); #endif diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h index 4b50c8a6c..41950005a 100644 --- a/src/gui/kernel/qaction.h +++ b/src/gui/kernel/qaction.h @@ -46,7 +46,7 @@ class Q_GUI_EXPORT QAction : public QObject Q_ENUMS(MenuRole) Q_ENUMS(Priority) Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed) - Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled) + Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY changed) Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY changed) Q_PROPERTY(QString text READ text WRITE setText NOTIFY changed) diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index bcce3a81e..d5579d071 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -98,9 +98,9 @@ class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice Q_PROPERTY(QRect normalGeometry READ normalGeometry) Q_PROPERTY(int x READ x) Q_PROPERTY(int y READ y) - Q_PROPERTY(QPoint pos READ pos WRITE move DESIGNABLE false STORED false) + Q_PROPERTY(QPoint pos READ pos WRITE move) Q_PROPERTY(QSize frameSize READ frameSize) - Q_PROPERTY(QSize size READ size WRITE resize DESIGNABLE false STORED false) + Q_PROPERTY(QSize size READ size WRITE resize) Q_PROPERTY(int width READ width) Q_PROPERTY(int height READ height) Q_PROPERTY(QRect rect READ rect) @@ -109,10 +109,10 @@ class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy) Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize) - Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false) - Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false) - Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false) - Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false) + Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth) + Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight) + Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth) + Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight) Q_PROPERTY(QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement) Q_PROPERTY(QSize baseSize READ baseSize WRITE setBaseSize) Q_PROPERTY(QPalette palette READ palette WRITE setPalette) @@ -125,19 +125,19 @@ class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) Q_PROPERTY(bool focus READ hasFocus) Q_PROPERTY(Qt::ContextMenuPolicy contextMenuPolicy READ contextMenuPolicy WRITE setContextMenuPolicy) - Q_PROPERTY(bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled DESIGNABLE false) - Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false) + Q_PROPERTY(bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible) Q_PROPERTY(bool minimized READ isMinimized) Q_PROPERTY(bool maximized READ isMaximized) Q_PROPERTY(bool fullScreen READ isFullScreen) Q_PROPERTY(QSize sizeHint READ sizeHint) Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint) Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops) - Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE isWindow) - Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon DESIGNABLE isWindow) - Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText DESIGNABLE isWindow) - Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow) - Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow) + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) + Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon) + Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText) + Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity) + Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified) #ifndef QT_NO_TOOLTIP Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) #endif diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h index 8be8a7c91..9194843f8 100644 --- a/src/gui/text/qtextcontrol_p.h +++ b/src/gui/text/qtextcontrol_p.h @@ -59,7 +59,7 @@ class Q_GUI_EXPORT QTextControl : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QTextControl) #ifndef QT_NO_TEXTHTMLPARSER - Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true) + Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged) #endif Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode) Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index f664a7cda..1ce5426a5 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -67,7 +67,7 @@ class Q_GUI_EXPORT QTextDocument : public QObject { Q_OBJECT Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled) - Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false) + Q_PROPERTY(bool modified READ isModified WRITE setModified) Q_PROPERTY(QSizeF pageSize READ pageSize WRITE setPageSize) Q_PROPERTY(QFont defaultFont READ defaultFont WRITE setDefaultFont) Q_PROPERTY(QSizeF size READ size) diff --git a/src/gui/widgets/qabstractbutton.h b/src/gui/widgets/qabstractbutton.h index 203b8b9dd..c9588e47b 100644 --- a/src/gui/widgets/qabstractbutton.h +++ b/src/gui/widgets/qabstractbutton.h @@ -44,12 +44,12 @@ class Q_GUI_EXPORT QAbstractButton : public QWidget Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) #endif Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable) - Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled USER true) + Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled) Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat) Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive) Q_PROPERTY(int autoRepeatDelay READ autoRepeatDelay WRITE setAutoRepeatDelay) Q_PROPERTY(int autoRepeatInterval READ autoRepeatInterval WRITE setAutoRepeatInterval) - Q_PROPERTY(bool down READ isDown WRITE setDown DESIGNABLE false) + Q_PROPERTY(bool down READ isDown WRITE setDown) public: explicit QAbstractButton(QWidget* parent = nullptr); diff --git a/src/gui/widgets/qabstractslider.h b/src/gui/widgets/qabstractslider.h index 192cac66c..b32d84fb8 100644 --- a/src/gui/widgets/qabstractslider.h +++ b/src/gui/widgets/qabstractslider.h @@ -38,13 +38,13 @@ class Q_GUI_EXPORT QAbstractSlider : public QWidget Q_PROPERTY(int maximum READ maximum WRITE setMaximum) Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep) Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep) - Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true) + Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition NOTIFY sliderMoved) Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance) Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls) - Q_PROPERTY(bool sliderDown READ isSliderDown WRITE setSliderDown DESIGNABLE false) + Q_PROPERTY(bool sliderDown READ isSliderDown WRITE setSliderDown) public: explicit QAbstractSlider(QWidget *parent=0); diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index 65e27f717..88cf81941 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -45,7 +45,7 @@ class Q_GUI_EXPORT QComboBox : public QWidget Q_ENUMS(SizeAdjustPolicy) Q_PROPERTY(bool editable READ isEditable WRITE setEditable) Q_PROPERTY(int count READ count) - Q_PROPERTY(QString currentText READ currentText USER true) + Q_PROPERTY(QString currentText READ currentText) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems) Q_PROPERTY(int maxCount READ maxCount WRITE setMaxCount) @@ -55,8 +55,8 @@ class Q_GUI_EXPORT QComboBox : public QWidget Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) #ifndef QT_NO_COMPLETER - Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion DESIGNABLE false) - Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity DESIGNABLE false) + Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion) + Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity) #endif // QT_NO_COMPLETER Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled) diff --git a/src/gui/widgets/qcommandlinkbutton.h b/src/gui/widgets/qcommandlinkbutton.h index c4112eb91..3dd01378b 100644 --- a/src/gui/widgets/qcommandlinkbutton.h +++ b/src/gui/widgets/qcommandlinkbutton.h @@ -35,7 +35,7 @@ class Q_GUI_EXPORT QCommandLinkButton: public QPushButton Q_OBJECT Q_PROPERTY(QString description READ description WRITE setDescription) - Q_PROPERTY(bool flat READ isFlat WRITE setFlat DESIGNABLE false) + Q_PROPERTY(bool flat READ isFlat WRITE setFlat) public: explicit QCommandLinkButton(QWidget *parent=0); diff --git a/src/gui/widgets/qdatetimeedit.h b/src/gui/widgets/qdatetimeedit.h index 720c043ad..40610502a 100644 --- a/src/gui/widgets/qdatetimeedit.h +++ b/src/gui/widgets/qdatetimeedit.h @@ -33,7 +33,7 @@ class QDateTimeEditPrivate; class Q_GUI_EXPORT QDateTimeEdit : public QWidget { Q_OBJECT - Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged USER true) + Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged) Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged) Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged) Q_PROPERTY(QDateTime maximumDateTime READ maximumDateTime) diff --git a/src/gui/widgets/qdockwidget.h b/src/gui/widgets/qdockwidget.h index 47886d75b..bd3a94c65 100644 --- a/src/gui/widgets/qdockwidget.h +++ b/src/gui/widgets/qdockwidget.h @@ -44,7 +44,7 @@ class Q_GUI_EXPORT QDockWidget : public QWidget Q_PROPERTY(DockWidgetFeatures features READ features WRITE setFeatures NOTIFY featuresChanged) Q_PROPERTY(Qt::DockWidgetAreas allowedAreas READ allowedAreas WRITE setAllowedAreas NOTIFY allowedAreasChanged) - Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE true) + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) public: explicit QDockWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0); diff --git a/src/gui/widgets/qframe.h b/src/gui/widgets/qframe.h index 0efa9ffed..0868507ad 100644 --- a/src/gui/widgets/qframe.h +++ b/src/gui/widgets/qframe.h @@ -40,7 +40,7 @@ class Q_GUI_EXPORT QFrame : public QWidget Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth) Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth) Q_PROPERTY(int frameWidth READ frameWidth) - Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false) + Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect) public: explicit QFrame(QWidget* parent = nullptr, Qt::WindowFlags f = 0); diff --git a/src/gui/widgets/qgroupbox.h b/src/gui/widgets/qgroupbox.h index ac250367b..e8028a6f0 100644 --- a/src/gui/widgets/qgroupbox.h +++ b/src/gui/widgets/qgroupbox.h @@ -40,7 +40,7 @@ class Q_GUI_EXPORT QGroupBox : public QWidget Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) Q_PROPERTY(bool flat READ isFlat WRITE setFlat) Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable) - Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled USER true) + Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled) public: explicit QGroupBox(QWidget* parent = nullptr); explicit QGroupBox(const QString &title, QWidget* parent = nullptr); diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index c52d039fd..ca7c2f1ac 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -46,14 +46,14 @@ class Q_GUI_EXPORT QLineEdit : public QWidget Q_ENUMS(EchoMode) Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask) - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true) + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength) Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode) Q_PROPERTY(QString displayText READ displayText) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition) Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) - Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false) + Q_PROPERTY(bool modified READ isModified WRITE setModified) Q_PROPERTY(bool hasSelectedText READ hasSelectedText) Q_PROPERTY(QString selectedText READ selectedText) Q_PROPERTY(bool dragEnabled READ dragEnabled WRITE setDragEnabled) diff --git a/src/gui/widgets/qplaintextedit.h b/src/gui/widgets/qplaintextedit.h index 80f0aae0c..bf32351d3 100644 --- a/src/gui/widgets/qplaintextedit.h +++ b/src/gui/widgets/qplaintextedit.h @@ -52,7 +52,7 @@ class Q_GUI_EXPORT QPlainTextEdit : public QAbstractScrollArea Q_PROPERTY(LineWrapMode lineWrapMode READ lineWrapMode WRITE setLineWrapMode) Q_PROPERTY(QTextOption::WrapMode wordWrapMode READ wordWrapMode WRITE setWordWrapMode) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) - Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText NOTIFY textChanged USER true) + Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText NOTIFY textChanged) Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode) Q_PROPERTY(int tabStopWidth READ tabStopWidth WRITE setTabStopWidth) Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) diff --git a/src/gui/widgets/qspinbox.h b/src/gui/widgets/qspinbox.h index 41eb88e49..ff8f4949e 100644 --- a/src/gui/widgets/qspinbox.h +++ b/src/gui/widgets/qspinbox.h @@ -41,7 +41,7 @@ class Q_GUI_EXPORT QSpinBox : public QAbstractSpinBox Q_PROPERTY(int minimum READ minimum WRITE setMinimum) Q_PROPERTY(int maximum READ maximum WRITE setMaximum) Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep) - Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true) + Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) public: explicit QSpinBox(QWidget *parent = nullptr); @@ -100,7 +100,7 @@ class Q_GUI_EXPORT QDoubleSpinBox : public QAbstractSpinBox Q_PROPERTY(double minimum READ minimum WRITE setMinimum) Q_PROPERTY(double maximum READ maximum WRITE setMaximum) Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep) - Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true) + Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged) public: explicit QDoubleSpinBox(QWidget *parent = nullptr); diff --git a/src/gui/widgets/qtextbrowser.h b/src/gui/widgets/qtextbrowser.h index 35ff24218..81a9d3efd 100644 --- a/src/gui/widgets/qtextbrowser.h +++ b/src/gui/widgets/qtextbrowser.h @@ -39,8 +39,8 @@ class Q_GUI_EXPORT QTextBrowser : public QTextEdit Q_PROPERTY(QUrl source READ source WRITE setSource) Q_OVERRIDE(bool modified SCRIPTABLE false) - Q_OVERRIDE(bool readOnly DESIGNABLE false SCRIPTABLE false) - Q_OVERRIDE(bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false) + Q_OVERRIDE(bool readOnly SCRIPTABLE false) + Q_OVERRIDE(bool undoRedoEnabled SCRIPTABLE false) Q_PROPERTY(QStringList searchPaths READ searchPaths WRITE setSearchPaths) Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) Q_PROPERTY(bool openLinks READ openLinks WRITE setOpenLinks) diff --git a/src/gui/widgets/qtextedit.h b/src/gui/widgets/qtextedit.h index 9306eb900..bd93285b2 100644 --- a/src/gui/widgets/qtextedit.h +++ b/src/gui/widgets/qtextedit.h @@ -50,9 +50,9 @@ class Q_GUI_EXPORT QTextEdit : public QAbstractScrollArea Q_PROPERTY(int lineWrapColumnOrWidth READ lineWrapColumnOrWidth WRITE setLineWrapColumnOrWidth) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) #ifndef QT_NO_TEXTHTMLPARSER - Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true) + Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged) #endif - Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText DESIGNABLE false) + Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText) Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode) Q_PROPERTY(int tabStopWidth READ tabStopWidth WRITE setTabStopWidth) Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) diff --git a/src/gui/widgets/qtoolbar.h b/src/gui/widgets/qtoolbar.h index 999953c9c..af7d5d115 100644 --- a/src/gui/widgets/qtoolbar.h +++ b/src/gui/widgets/qtoolbar.h @@ -41,18 +41,11 @@ class Q_GUI_EXPORT QToolBar : public QWidget { Q_OBJECT - Q_PROPERTY(bool movable READ isMovable WRITE setMovable - DESIGNABLE (qobject_cast(parentWidget()) != 0) - NOTIFY movableChanged) - Q_PROPERTY(Qt::ToolBarAreas allowedAreas READ allowedAreas WRITE setAllowedAreas - DESIGNABLE (qobject_cast(parentWidget()) != 0) - NOTIFY allowedAreasChanged) - Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation - DESIGNABLE (qobject_cast(parentWidget()) == 0) - NOTIFY orientationChanged) + Q_PROPERTY(bool movable READ isMovable WRITE setMovable NOTIFY movableChanged) + Q_PROPERTY(Qt::ToolBarAreas allowedAreas READ allowedAreas WRITE setAllowedAreas NOTIFY allowedAreasChanged) + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged) - Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle - NOTIFY toolButtonStyleChanged) + Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle NOTIFY toolButtonStyleChanged) Q_PROPERTY(bool floating READ isFloating) Q_PROPERTY(bool floatable READ isFloatable WRITE setFloatable) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 1177288c0..975a51441 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -153,14 +153,10 @@ void Generator::generateCode() int methodCount = cdef->signalList.count() + cdef->slotList.count() + cdef->methodList.count(); fprintf(out, " %4d, %4d, // methods\n", methodCount, methodCount ? index : 0); index += methodCount * 5; - if (cdef->revisionedMethods) - index += methodCount; fprintf(out, " %4d, %4d, // properties\n", cdef->propertyList.count(), cdef->propertyList.count() ? index : 0); index += cdef->propertyList.count() * 3; if(cdef->notifyableProperties) index += cdef->propertyList.count(); - if (cdef->revisionedProperties) - index += cdef->propertyList.count(); fprintf(out, " %4d, %4d, // enums/sets\n", cdef->enumList.count(), cdef->enumList.count() ? index : 0); int enumsIndex = index; @@ -193,15 +189,6 @@ void Generator::generateCode() // generateFunctions(cdef->methodList, "method", MethodMethod); -// -// Build method version arrays -// - if (cdef->revisionedMethods) { - generateFunctionRevisions(cdef->signalList, "signal"); - generateFunctionRevisions(cdef->slotList, "slot"); - generateFunctionRevisions(cdef->methodList, "method"); - } - // // Build property array // @@ -400,8 +387,6 @@ void Generator::generateFunctions(QList& list, const char *functype flags |= MethodCloned; if (f.isScriptable) flags |= MethodScriptable; - if (f.revision > 0) - flags |= MethodRevisioned; fprintf(out, " %4d, %4d, %4d, %4d, 0x%02x,\n", strreg(sig.constData()), strreg(arguments.constData()), @@ -410,16 +395,6 @@ void Generator::generateFunctions(QList& list, const char *functype } } -void Generator::generateFunctionRevisions(QList& list, const char *functype) -{ - if (list.count()) - fprintf(out, "\n // %ss: revision\n", functype); - for (int i = 0; i < list.count(); ++i) { - const FunctionDef &f = list.at(i); - fprintf(out, " %4d,\n", f.revision); - } -} - void Generator::generateProperties() { // @@ -449,42 +424,14 @@ void Generator::generateProperties() // if (p.override) // flags |= Override; - if (p.designable.isEmpty()) - flags |= ResolveDesignable; - else if (p.designable != "false") - flags |= Designable; - if (p.scriptable.isEmpty()) flags |= ResolveScriptable; else if (p.scriptable != "false") flags |= Scriptable; - if (p.stored.isEmpty()) - flags |= ResolveStored; - else if (p.stored != "false") - flags |= Stored; - - if (p.editable.isEmpty()) - flags |= ResolveEditable; - else if (p.editable != "false") - flags |= Editable; - - if (p.user.isEmpty()) - flags |= ResolveUser; - else if (p.user != "false") - flags |= User; - if (p.notifyId != -1) flags |= Notify; - if (p.revision > 0) - flags |= Revisioned; - - if (p.constant) - flags |= Constant; - if (p.final) - flags |= Final; - fprintf(out, " %4d, %4d, ", strreg(p.name.constData()), strreg(p.type.constData())); @@ -505,13 +452,6 @@ void Generator::generateProperties() p.notifyId); } } - if (cdef->revisionedProperties) { - fprintf(out, "\n // properties: revision\n"); - for (int i = 0; i < cdef->propertyList.count(); ++i) { - const PropertyDef &p = cdef->propertyList.at(i); - fprintf(out, " %4d,\n", p.revision); - } - } } void Generator::generateEnums(int index) @@ -583,21 +523,13 @@ void Generator::generateMetacall() bool needGet = false; bool needSet = false; bool needReset = false; - bool needDesignable = false; bool needScriptable = false; - bool needStored = false; - bool needEditable = false; - bool needUser = false; for (int i = 0; i < cdef->propertyList.size(); ++i) { const PropertyDef &p = cdef->propertyList.at(i); needGet |= !p.read.isEmpty(); needSet |= !p.write.isEmpty(); needReset |= !p.reset.isEmpty(); - needDesignable |= p.designable.endsWith(')'); needScriptable |= p.scriptable.endsWith(')'); - needStored |= p.stored.endsWith(')'); - needEditable |= p.editable.endsWith(')'); - needUser |= p.user.endsWith(')'); } fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n "); @@ -686,23 +618,6 @@ void Generator::generateMetacall() " _id -= %d;\n" " }", cdef->propertyList.count()); - fprintf(out, " else "); - fprintf(out, "if (_c == QMetaObject::QueryPropertyDesignable) {\n"); - if (needDesignable) { - fprintf(out, " switch (_id) {\n"); - for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) { - const PropertyDef &p = cdef->propertyList.at(propindex); - if (!p.designable.endsWith(')')) - continue; - fprintf(out, " case %d: *static_cast(_a[0]) = %s; break;\n", - propindex, p.designable.constData()); - } - fprintf(out, " }\n"); - } - fprintf(out, - " _id -= %d;\n" - " }", cdef->propertyList.count()); - fprintf(out, " else if (_c == QMetaObject::QueryPropertyScriptable) {\n"); if (needScriptable) { fprintf(out, " switch (_id) {\n"); @@ -719,56 +634,6 @@ void Generator::generateMetacall() " _id -= %d;\n" " }", cdef->propertyList.count()); - fprintf(out, " else if (_c == QMetaObject::QueryPropertyStored) {\n"); - if (needStored) { - fprintf(out, " switch (_id) {\n"); - for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) { - const PropertyDef &p = cdef->propertyList.at(propindex); - if (!p.stored.endsWith(')')) - continue; - fprintf(out, " case %d: *static_cast(_a[0]) = %s; break;\n", - propindex, p.stored.constData()); - } - fprintf(out, " }\n"); - } - fprintf(out, - " _id -= %d;\n" - " }", cdef->propertyList.count()); - - fprintf(out, " else if (_c == QMetaObject::QueryPropertyEditable) {\n"); - if (needEditable) { - fprintf(out, " switch (_id) {\n"); - for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) { - const PropertyDef &p = cdef->propertyList.at(propindex); - if (!p.editable.endsWith(')')) - continue; - fprintf(out, " case %d: *static_cast(_a[0]) = %s; break;\n", - propindex, p.editable.constData()); - } - fprintf(out, " }\n"); - } - fprintf(out, - " _id -= %d;\n" - " }", cdef->propertyList.count()); - - - fprintf(out, " else if (_c == QMetaObject::QueryPropertyUser) {\n"); - if (needUser) { - fprintf(out, " switch (_id) {\n"); - for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) { - const PropertyDef &p = cdef->propertyList.at(propindex); - if (!p.user.endsWith(')')) - continue; - fprintf(out, " case %d: *static_cast(_a[0]) = %s; break;\n", - propindex, p.user.constData()); - } - fprintf(out, " }\n"); - } - fprintf(out, - " _id -= %d;\n" - " }", cdef->propertyList.count()); - - fprintf(out, "\n#endif // QT_NO_PROPERTIES"); } if (methodList.size() || cdef->signalList.size() || cdef->propertyList.size()) diff --git a/src/tools/moc/generator.h b/src/tools/moc/generator.h index 23d192013..970794ea4 100644 --- a/src/tools/moc/generator.h +++ b/src/tools/moc/generator.h @@ -37,7 +37,6 @@ public: private: void generateClassInfos(); void generateFunctions(QList &list, const char *functype, int type); - void generateFunctionRevisions(QList& list, const char *functype); void generateEnums(int index); void generateProperties(); void generateMetacall(); diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp index ef001e8ab..58f888706 100644 --- a/src/tools/moc/keywords.cpp +++ b/src/tools/moc/keywords.cpp @@ -23,12 +23,12 @@ // DO NOT EDIT. static const short keyword_trans[][128] = { - {0,0,0,0,0,0,0,0,0,520,517,0,0,0,0,0, + {0,0,0,0,0,0,0,0,0,512,509,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 520,252,518,521,0,38,239,519,25,26,236,234,30,235,27,237, + 512,252,510,513,0,38,239,511,25,26,236,234,30,235,27,237, 22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43, 0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,21,8,8,8,8,8,8,8,8,8,31,522,32,238,8, + 8,21,8,8,8,8,8,8,8,8,8,31,514,32,238,8, 0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13, 14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -162,7 +162,7 @@ static const short keyword_trans[][128] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0, - 525,525,525,525,525,525,525,525,525,525,0,0,0,0,0,0, + 517,517,517,517,517,517,517,517,517,517,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -321,7 +321,7 @@ static const short keyword_trans[][128] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,524,0,0,0,0,523, + 0,0,0,0,0,0,0,0,0,0,516,0,0,0,0,515, 0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -364,7 +364,7 @@ static const short keyword_trans[][128] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,439,388,378,383,364,0,448,0,0,0,0,0,358, - 370,0,509,436,0,0,0,0,0,0,0,0,0,0,0,0, + 370,0,0,436,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -926,14 +926,6 @@ static const struct {CHARACTER, 0, 84, 507, CHARACTER}, {CHARACTER, 0, 89, 508, CHARACTER}, {Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER}, - {CHARACTER, 0, 69, 510, CHARACTER}, - {CHARACTER, 0, 86, 511, CHARACTER}, - {CHARACTER, 0, 73, 512, CHARACTER}, - {CHARACTER, 0, 83, 513, CHARACTER}, - {CHARACTER, 0, 73, 514, CHARACTER}, - {CHARACTER, 0, 79, 515, CHARACTER}, - {CHARACTER, 0, 78, 516, CHARACTER}, - {Q_REVISION_TOKEN, 0, 0, 0, CHARACTER}, {NEWLINE, 0, 0, 0, NOTOKEN}, {QUOTE, 0, 0, 0, NOTOKEN}, {SINGLEQUOTE, 0, 0, 0, NOTOKEN}, diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 999bb3303..6770542d9 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -74,7 +74,7 @@ bool Moc::parseClassHead(ClassDef *def) QByteArray name = lexem(); // support "class IDENT name" and "class IDENT(IDENT) name" - // also support "class IDENT name (final|sealed|Q_DECL_FINAL)" + // also support "class IDENT name (final|sealed)" if (test(LPAREN)) { until(RPAREN); if (!test(IDENTIFIER)) @@ -82,7 +82,7 @@ bool Moc::parseClassHead(ClassDef *def) name = lexem(); } else if (test(IDENTIFIER)) { const QByteArray lex = lexem(); - if (lex != "final" && lex != "sealed" && lex != "Q_DECL_FINAL") + if (lex != "final" && lex != "sealed") name = lex; } @@ -98,7 +98,7 @@ bool Moc::parseClassHead(ClassDef *def) if (test(IDENTIFIER)) { const QByteArray lex = lexem(); - if (lex != "final" && lex != "sealed" && lex != "Q_DECL_FINAL") + if (lex != "final" && lex != "sealed") return false; } @@ -316,23 +316,6 @@ bool Moc::testFunctionAttribute(Token tok, FunctionDef *def) return false; } -bool Moc::testFunctionRevision(FunctionDef *def) -{ - if (test(Q_REVISION_TOKEN)) { - next(LPAREN); - QByteArray revision = lexemUntil(RPAREN); - revision.remove(0, 1); - revision.chop(1); - bool ok = false; - def->revision = revision.toInt(&ok); - if (!ok || def->revision < 0) - error("Invalid revision"); - return true; - } - - return false; -} - // returns false if the function should be ignored bool Moc::parseFunction(FunctionDef *def, bool inMacro) { @@ -341,7 +324,7 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro) //skip modifiers and attributes while (test(INLINE) || (test(STATIC) && (def->isStatic = true) == true) || (test(VIRTUAL) && (def->isVirtual = true) == true) //mark as virtual - || testFunctionAttribute(def) || testFunctionRevision(def)) {} + || testFunctionAttribute(def)) {} bool templateFunction = (lookup() == TEMPLATE); def->type = parseType(); if (def->type.name.isEmpty()) { @@ -433,7 +416,7 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def) //skip modifiers and attributes while (test(EXPLICIT) || test(INLINE) || (test(STATIC) && (def->isStatic = true) == true) || (test(VIRTUAL) && (def->isVirtual = true) == true) //mark as virtual - || testFunctionAttribute(def) || testFunctionRevision(def)) {} + || testFunctionAttribute(def)) {} bool tilde = test(TILDE); def->type = parseType(); if (def->type.name.isEmpty()) @@ -698,8 +681,6 @@ void Moc::parse() funcDef.arguments.removeLast(); def.slotList += funcDef; } - if (funcDef.revision > 0) - ++def.revisionedMethods; } else if (funcDef.isSignal) { def.signalList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { @@ -707,8 +688,6 @@ void Moc::parse() funcDef.arguments.removeLast(); def.signalList += funcDef; } - if (funcDef.revision > 0) - ++def.revisionedMethods; } else if (funcDef.isInvokable) { def.methodList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { @@ -716,8 +695,6 @@ void Moc::parse() funcDef.arguments.removeLast(); def.methodList += funcDef; } - if (funcDef.revision > 0) - ++def.revisionedMethods; } } } else { @@ -800,18 +777,6 @@ void Moc::generate(FILE *out) void Moc::parseSlots(ClassDef *def, FunctionDef::Access access) { - int defaultRevision = -1; - if (test(Q_REVISION_TOKEN)) { - next(LPAREN); - QByteArray revision = lexemUntil(RPAREN); - revision.remove(0, 1); - revision.chop(1); - bool ok = false; - defaultRevision = revision.toInt(&ok); - if (!ok || defaultRevision < 0) - error("Invalid revision"); - } - next(COLON); while (inClass(def) && hasNext()) { switch (next()) { @@ -837,12 +802,6 @@ void Moc::parseSlots(ClassDef *def, FunctionDef::Access access) funcDef.access = access; if (!parseFunction(&funcDef)) continue; - if (funcDef.revision > 0) { - ++def->revisionedMethods; - } else if (defaultRevision != -1) { - funcDef.revision = defaultRevision; - ++def->revisionedMethods; - } def->slotList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { funcDef.wasCloned = true; @@ -854,18 +813,6 @@ void Moc::parseSlots(ClassDef *def, FunctionDef::Access access) void Moc::parseSignals(ClassDef *def) { - int defaultRevision = -1; - if (test(Q_REVISION_TOKEN)) { - next(LPAREN); - QByteArray revision = lexemUntil(RPAREN); - revision.remove(0, 1); - revision.chop(1); - bool ok = false; - defaultRevision = revision.toInt(&ok); - if (!ok || defaultRevision < 0) - error("Invalid revision"); - } - next(COLON); while (inClass(def) && hasNext()) { switch (next()) { @@ -893,12 +840,6 @@ void Moc::parseSignals(ClassDef *def) warning("Signals cannot be declared virtual"); if (funcDef.inlineCode) error("Not a signal declaration"); - if (funcDef.revision > 0) { - ++def->revisionedMethods; - } else if (defaultRevision != -1) { - funcDef.revision = defaultRevision; - ++def->revisionedMethods; - } def->signalList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { funcDef.wasCloned = true; @@ -913,8 +854,7 @@ void Moc::createPropertyDef(PropertyDef &propDef) QByteArray type = parseType().name; if (type.isEmpty()) error(); - propDef.designable = propDef.scriptable = propDef.stored = "true"; - propDef.user = "false"; + propDef.scriptable = "true"; /* The Q_PROPERTY construct cannot contain any commas, since commas separate macro arguments. We therefore expect users @@ -941,66 +881,33 @@ void Moc::createPropertyDef(PropertyDef &propDef) propDef.name = lexem(); while (test(IDENTIFIER)) { QByteArray l = lexem(); - if (l[0] == 'C' && l == "CONSTANT") { - propDef.constant = true; - continue; - } else if(l[0] == 'F' && l == "FINAL") { - propDef.final = true; - continue; - } QByteArray v, v2; - if (test(LPAREN)) { - v = lexemUntil(RPAREN); - } else if (test(INTEGER_LITERAL)) { - v = lexem(); - if (l != "REVISION") - error(1); - } else { - next(IDENTIFIER); - v = lexem(); - if (test(LPAREN)) - v2 = lexemUntil(RPAREN); - else if (v != "true" && v != "false") - v2 = "()"; - } + next(IDENTIFIER); + v = lexem(); + if (v != "true" && v != "false") + v2 = "()"; switch (l[0]) { case 'R': if (l == "READ") propDef.read = v; else if (l == "RESET") propDef.reset = v + v2; - else if (l == "REVISION") { - bool ok = false; - propDef.revision = v.toInt(&ok); - if (!ok || propDef.revision < 0) - error(1); - } else + else error(2); break; case 'S': if (l == "SCRIPTABLE") propDef.scriptable = v + v2; - else if (l == "STORED") - propDef.stored = v + v2; else error(2); break; case 'W': if (l != "WRITE") error(2); propDef.write = v; break; - case 'D': if (l != "DESIGNABLE") error(2); - propDef.designable = v + v2; - break; - case 'E': if (l != "EDITABLE") error(2); - propDef.editable = v + v2; - break; case 'N': if (l != "NOTIFY") error(2); propDef.notify = v; break; - case 'U': if (l != "USER") error(2); - propDef.user = v + v2; - break; default: error(2); } @@ -1012,22 +919,6 @@ void Moc::createPropertyDef(PropertyDef &propDef) msg += " has no READ accessor function. The property will be invalid."; warning(msg.constData()); } - if (propDef.constant && !propDef.write.isNull()) { - QByteArray msg; - msg += "Property declaration "; - msg += propDef.name; - msg += " is both WRITEable and CONSTANT. CONSTANT will be ignored."; - propDef.constant = false; - warning(msg.constData()); - } - if (propDef.constant && !propDef.notify.isNull()) { - QByteArray msg; - msg += "Property declaration "; - msg += propDef.name; - msg += " is both NOTIFYable and CONSTANT. CONSTANT will be ignored."; - propDef.constant = false; - warning(msg.constData()); - } } void Moc::parseProperty(ClassDef *def) @@ -1040,8 +931,6 @@ void Moc::parseProperty(ClassDef *def) if(!propDef.notify.isEmpty()) def->notifyableProperties++; - if (propDef.revision > 0) - ++def->revisionedProperties; def->propertyList += propDef; } @@ -1068,8 +957,6 @@ void Moc::parsePrivateProperty(ClassDef *def) if(!propDef.notify.isEmpty()) def->notifyableProperties++; - if (propDef.revision > 0) - ++def->revisionedProperties; def->propertyList += propDef; } @@ -1219,9 +1106,6 @@ void Moc::parseSlotInPrivate(ClassDef *def, FunctionDef::Access access) funcDef.arguments.removeLast(); def->slotList += funcDef; } - if (funcDef.revision > 0) - ++def->revisionedMethods; - } QByteArray Moc::lexemUntil(Token target) diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 1cc6445e0..3c921d152 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -62,10 +62,14 @@ struct ArgumentDef struct FunctionDef { - FunctionDef(): returnTypeIsVolatile(false), access(Private), isConst(false), isVirtual(false), isStatic(false), - inlineCode(false), wasCloned(false), isInvokable(false), - isScriptable(false), isSlot(false), isSignal(false), - isConstructor(false), isDestructor(false), isAbstract(false), revision(0) {} + FunctionDef() : + returnTypeIsVolatile(false), access(Private), isConst(false), isVirtual(false), isStatic(false), + inlineCode(false), wasCloned(false), isInvokable(false), + isScriptable(false), isSlot(false), isSignal(false), + isConstructor(false), isDestructor(false), isAbstract(false) + { + } + Type type; QByteArray normalizedType; QByteArray tag; @@ -90,17 +94,13 @@ struct FunctionDef bool isConstructor; bool isDestructor; bool isAbstract; - - int revision; }; struct PropertyDef { - PropertyDef():notifyId(-1), constant(false), final(false), gspec(ValueSpec), revision(0){} - QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify, inPrivateClass; + PropertyDef():notifyId(-1), gspec(ValueSpec), revision(0){} + QByteArray name, type, read, write, reset, scriptable, notify, inPrivateClass; int notifyId; - bool constant; - bool final; enum Specification { ValueSpec, ReferenceSpec, PointerSpec }; Specification gspec; bool stdCppSet() const { @@ -122,7 +122,7 @@ struct ClassInfoDef struct ClassDef { ClassDef(): hasQObject(false), hasQGadget(false), notifyableProperties(0) - , revisionedMethods(0), revisionedProperties(0), begin(0), end(0){} + , begin(0), end(0){} QByteArray classname; QByteArray qualified; QList > superclassList; @@ -147,8 +147,6 @@ struct ClassDef { QMap enumDeclarations; QList enumList; QMap flagAliases; - int revisionedMethods; - int revisionedProperties; int begin; int end; @@ -220,7 +218,6 @@ public: // in FunctionDef accordingly bool testFunctionAttribute(FunctionDef *def); bool testFunctionAttribute(Token tok, FunctionDef *def); - bool testFunctionRevision(FunctionDef *def); void checkSuperClasses(ClassDef *def); void checkProperties(ClassDef* cdef); diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp index a115c6cf7..72a2c27a6 100644 --- a/src/tools/moc/util/generate_keywords.cpp +++ b/src/tools/moc/util/generate_keywords.cpp @@ -230,7 +230,6 @@ static const Keyword keywords[] = { { "Q_SLOT", "Q_SLOT_TOKEN" }, { "Q_SCRIPTABLE", "Q_SCRIPTABLE_TOKEN" }, { "Q_PRIVATE_PROPERTY", "Q_PRIVATE_PROPERTY_TOKEN" }, - { "Q_REVISION", "Q_REVISION_TOKEN" }, { "\n", "NEWLINE" }, { "\"", "QUOTE" }, { "\'", "SINGLEQUOTE" }, diff --git a/tests/auto/qdbusmetaobject/tst_qdbusmetaobject.cpp b/tests/auto/qdbusmetaobject/tst_qdbusmetaobject.cpp index 8ad113a04..2dabce51d 100644 --- a/tests/auto/qdbusmetaobject/tst_qdbusmetaobject.cpp +++ b/tests/auto/qdbusmetaobject/tst_qdbusmetaobject.cpp @@ -397,15 +397,11 @@ void tst_QDBusMetaObject::types() QVERIFY(propIdx != -1); QMetaProperty constructed = result->property(propIdx); - QCOMPARE(constructed.isDesignable(), expected.isDesignable()); - QCOMPARE(constructed.isEditable(), expected.isEditable()); QCOMPARE(constructed.isEnumType(), expected.isEnumType()); QCOMPARE(constructed.isFlagType(), expected.isFlagType()); QCOMPARE(constructed.isReadable(), expected.isReadable()); QCOMPARE(constructed.isResettable(), expected.isResettable()); QCOMPARE(constructed.isScriptable(), expected.isScriptable()); - QCOMPARE(constructed.isStored(), expected.isStored()); - QCOMPARE(constructed.isUser(), expected.isUser()); QCOMPARE(constructed.isWritable(), expected.isWritable()); QCOMPARE(constructed.typeName(), expected.typeName()); } diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index 5bf14d1fb..d3f10cad0 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -90,8 +90,6 @@ class tst_QMetaObject : public QObject Q_PROPERTY(int value6 READ value6 NOTIFY value6Changed) Q_PROPERTY(MyStruct value7 READ value7 WRITE setVal7 NOTIFY value7Changed) Q_PROPERTY(int value8 READ value8) - Q_PROPERTY(int value9 READ value9 CONSTANT) - Q_PROPERTY(int value10 READ value10 FINAL) public: enum EnumType { EnumType1 }; @@ -121,10 +119,6 @@ public: int value8() const { return 1; } - int value9() const { return 1; } - - int value10() const { return 1; } - QList value4; QVariantList value5; @@ -149,8 +143,6 @@ private slots: void customPropertyType(); void checkScope(); void propertyNotify(); - void propertyConstant(); - void propertyFinal(); void stdSet(); void classInfo(); @@ -974,32 +966,6 @@ void tst_QMetaObject::propertyNotify() QCOMPARE(signal.signature(), (const char *)0); } -void tst_QMetaObject::propertyConstant() -{ - const QMetaObject *mo = metaObject(); - - QMetaProperty prop = mo->property(mo->indexOfProperty("value8")); - QVERIFY(prop.isValid()); - QVERIFY(!prop.isConstant()); - - prop = mo->property(mo->indexOfProperty("value9")); - QVERIFY(prop.isValid()); - QVERIFY(prop.isConstant()); -} - -void tst_QMetaObject::propertyFinal() -{ - const QMetaObject *mo = metaObject(); - - QMetaProperty prop = mo->property(mo->indexOfProperty("value10")); - QVERIFY(prop.isValid()); - QVERIFY(prop.isFinal()); - - prop = mo->property(mo->indexOfProperty("value9")); - QVERIFY(prop.isValid()); - QVERIFY(!prop.isFinal()); -} - class ClassInfoTestObjectA : public QObject { Q_OBJECT