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
9QT_BEGIN_NAMESPACE
10
11class QSignalMapperPrivate;
12
13class Q_CORE_EXPORT QSignalMapper : public QObject
14{
15 Q_OBJECT
16 Q_DECLARE_PRIVATE(QSignalMapper)
17public:
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
30Q_SIGNALS:
31 void mappedInt(int);
32 void mappedString(const QString &);
33 void mappedObject(QObject *);
34
35public Q_SLOTS:
36 void map();
37 void map(QObject *sender);
38
39private:
40 Q_DISABLE_COPY(QSignalMapper)
41 Q_PRIVATE_SLOT(d_func(), void _q_senderDestroyed())
42};
43
44QT_END_NAMESPACE
45
46#endif // QSIGNALMAPPER_H
47

source code of qtbase/src/corelib/kernel/qsignalmapper.h