1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QSIGNALMAPPER_H |
5 | #define QSIGNALMAPPER_H |
6 | |
7 | #include <QtCore/qobject.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QSignalMapperPrivate; |
12 | |
13 | class Q_CORE_EXPORT QSignalMapper : public QObject |
14 | { |
15 | Q_OBJECT |
16 | Q_DECLARE_PRIVATE(QSignalMapper) |
17 | public: |
18 | explicit QSignalMapper(QObject *parent = nullptr); |
19 | ~QSignalMapper(); |
20 | |
21 | void setMapping(QObject *sender, int id); |
22 | void setMapping(QObject *sender, const QString &text); |
23 | void setMapping(QObject *sender, QObject *object); |
24 | void removeMappings(QObject *sender); |
25 | |
26 | QObject *mapping(int id) const; |
27 | QObject *mapping(const QString &text) const; |
28 | QObject *mapping(QObject *object) const; |
29 | |
30 | Q_SIGNALS: |
31 | void mappedInt(int); |
32 | void mappedString(const QString &); |
33 | void mappedObject(QObject *); |
34 | |
35 | public Q_SLOTS: |
36 | void map(); |
37 | void map(QObject *sender); |
38 | |
39 | private: |
40 | Q_DISABLE_COPY(QSignalMapper) |
41 | Q_PRIVATE_SLOT(d_func(), void _q_senderDestroyed()) |
42 | }; |
43 | |
44 | QT_END_NAMESPACE |
45 | |
46 | #endif // QSIGNALMAPPER_H |
47 | |