diff options
Diffstat (limited to 'src/corelib/kernel/qsignalmapper.cpp')
-rw-r--r-- | src/corelib/kernel/qsignalmapper.cpp | 101 |
1 files changed, 3 insertions, 98 deletions
diff --git a/src/corelib/kernel/qsignalmapper.cpp b/src/corelib/kernel/qsignalmapper.cpp index dc0dfe8f40..8e690d15ff 100644 --- a/src/corelib/kernel/qsignalmapper.cpp +++ b/src/corelib/kernel/qsignalmapper.cpp @@ -60,28 +60,19 @@ public: Q_Q(QSignalMapper); auto it = mappedValues.find(sender); - if (it != mappedValues.end()) { -#if QT_DEPRECATED_SINCE(5, 15) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - Q_EMIT q->mapped(*it); -QT_WARNING_POP -#endif + if (it != mappedValues.end()) Q_EMIT (q->*signal)(*it); - } } void emitMappedValues(QObject *sender) { emitMappedValue(sender, &QSignalMapper::mappedInt, intHash); emitMappedValue(sender, &QSignalMapper::mappedString, stringHash); - emitMappedValue(sender, &QSignalMapper::mappedWidget, widgetHash); emitMappedValue(sender, &QSignalMapper::mappedObject, objectHash); } QHash<QObject *, int> intHash; QHash<QObject *, QString> stringHash; - QHash<QObject *, QWidget*> widgetHash; QHash<QObject *, QObject*> objectHash; }; @@ -102,8 +93,8 @@ QT_WARNING_POP The class supports the mapping of particular strings, integers, objects and widgets with particular objects using setMapping(). The objects' signals can then be connected to the map() slot which - will emit a signal (it could be mappedInt(), mappedString(), - mappedWidget() and mappedObject()) with a value associated with + will emit a signal (it could be mappedInt(), mappedString() + and mappedObject()) with a value associated with the original signalling object. Mappings can be removed later using removeMappings(). @@ -191,19 +182,6 @@ void QSignalMapper::setMapping(QObject *sender, const QString &text) /*! Adds a mapping so that when map() is signalled from the \a sender, - the signal mappedWidget(\a widget ) is emitted. - - There may be at most one widget for each sender. -*/ -void QSignalMapper::setMapping(QObject *sender, QWidget *widget) -{ - Q_D(QSignalMapper); - d->widgetHash.insert(sender, widget); - connect(sender, SIGNAL(destroyed()), this, SLOT(_q_senderDestroyed())); -} - -/*! - Adds a mapping so that when map() is signalled from the \a sender, the signal mappedObject(\a object ) is emitted. There may be at most one object for each sender. @@ -238,17 +216,6 @@ QObject *QSignalMapper::mapping(const QString &id) const /*! \overload mapping() - Returns the sender QObject that is associated with the \a widget. -*/ -QObject *QSignalMapper::mapping(QWidget *widget) const -{ - Q_D(const QSignalMapper); - return d->widgetHash.key(widget); -} - -/*! - \overload mapping() - Returns the sender QObject that is associated with the \a object. */ QObject *QSignalMapper::mapping(QObject *object) const @@ -271,7 +238,6 @@ void QSignalMapper::removeMappings(QObject *sender) d->intHash.remove(sender); d->stringHash.remove(sender); - d->widgetHash.remove(sender); d->objectHash.remove(sender); } @@ -288,56 +254,6 @@ void QSignalMapper::map(QObject *sender) d_func()->emitMappedValues(sender); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \fn void QSignalMapper::mapped(int i) - \obsolete - \overload - - This signal is emitted when map() is signalled from an object that - has an integer mapping set. The object's mapped integer is passed - in \a i. - - \sa setMapping() -*/ - -/*! - \fn void QSignalMapper::mapped(const QString &text) - \obsolete - \overload - - This signal is emitted when map() is signalled from an object that - has a string mapping set. The object's mapped string is passed in - \a text. - - \sa setMapping() -*/ - -/*! - \fn void QSignalMapper::mapped(QWidget *widget) - \obsolete - \overload - - This signal is emitted when map() is signalled from an object that - has a widget mapping set. The object's mapped widget is passed in - \a widget. - - \sa setMapping() -*/ - -/*! - \fn void QSignalMapper::mapped(QObject *object) - \obsolete - \overload - - This signal is emitted when map() is signalled from an object that - has an object mapping set. The object provided by the map is passed in - \a object. - - \sa setMapping() -*/ -#endif - /*! \fn void QSignalMapper::mappedInt(int i) \since 5.15 @@ -361,17 +277,6 @@ void QSignalMapper::map(QObject *sender) */ /*! - \fn void QSignalMapper::mappedWidget(QWidget *widget) - \since 5.15 - - This signal is emitted when map() is signalled from an object that - has a widget mapping set. The object's mapped widget is passed in - \a widget. - - \sa setMapping() -*/ - -/*! \fn void QSignalMapper::mappedObject(QObject *object) \since 5.15 |