summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qsignalmapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-03-19 13:30:35 +0100
committerLars Knoll <lars.knoll@qt.io>2020-03-25 09:46:15 +0100
commit874c6b00dd52a62633a8afb5c1749b2ab50db6b6 (patch)
treeaed30ff95e6577997936592a3dd5237e8901144f /src/corelib/kernel/qsignalmapper.cpp
parent53f8f233692b6f9cd622eafbf669c5f8bdb0a25d (diff)
Remove QSignalMapper::mappedWidget()
mappedObject() can do exactly the same thing, there's no need for a mappedWidget() signal as well This removes a reverse dependency between Qt Widgets and Qt Core where QWidget pointers are being used inside Qt Core. [ChangeLog][QtCore] Removed QSignalMapper::mappedWidget. Connect to mappedObject instead, and use qobject_cast<QWidget *> to handle Widgets. Change-Id: I60618a34dd94575e993bd6d8a2cead95cfd71d55 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/kernel/qsignalmapper.cpp')
-rw-r--r--src/corelib/kernel/qsignalmapper.cpp42
1 files changed, 2 insertions, 40 deletions
diff --git a/src/corelib/kernel/qsignalmapper.cpp b/src/corelib/kernel/qsignalmapper.cpp
index 0dc9666df6..8e690d15ff 100644
--- a/src/corelib/kernel/qsignalmapper.cpp
+++ b/src/corelib/kernel/qsignalmapper.cpp
@@ -68,13 +68,11 @@ public:
{
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;
};
@@ -95,8 +93,8 @@ public:
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().
@@ -184,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.
@@ -231,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
@@ -264,7 +238,6 @@ void QSignalMapper::removeMappings(QObject *sender)
d->intHash.remove(sender);
d->stringHash.remove(sender);
- d->widgetHash.remove(sender);
d->objectHash.remove(sender);
}
@@ -304,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