Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/kernel/qsignalmapper.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | class QSignalMapperPrivate : public QObjectPrivate | - | ||||||
5 | { | - | ||||||
6 | inline QSignalMapper* q_func() { return static_cast<QSignalMapper *>(q_ptr); } inline const QSignalMapper* q_func() const { return static_cast<const QSignalMapper *>(q_ptr); } friend class QSignalMapper; | - | ||||||
7 | public: | - | ||||||
8 | void _q_senderDestroyed() { | - | ||||||
9 | QSignalMapper * const q = q_func(); | - | ||||||
10 | q->removeMappings(q->sender()); | - | ||||||
11 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||
12 | QHash<QObject *, int> intHash; | - | ||||||
13 | QHash<QObject *, QString> stringHash; | - | ||||||
14 | QHash<QObject *, QWidget*> widgetHash; | - | ||||||
15 | QHash<QObject *, QObject*> objectHash; | - | ||||||
16 | - | |||||||
17 | }; | - | ||||||
18 | QSignalMapper::QSignalMapper(QObject* parent) | - | ||||||
19 | : QObject(*new QSignalMapperPrivate, parent) | - | ||||||
20 | { | - | ||||||
21 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||
22 | - | |||||||
23 | - | |||||||
24 | - | |||||||
25 | - | |||||||
26 | QSignalMapper::~QSignalMapper() | - | ||||||
27 | { | - | ||||||
28 | } | - | ||||||
29 | void QSignalMapper::setMapping(QObject *sender, int id) | - | ||||||
30 | { | - | ||||||
31 | QSignalMapperPrivate * const d = d_func(); | - | ||||||
32 | d->intHash.insert(sender, id); | - | ||||||
33 | connect(sender, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "141"), this, qFlagLocation("1""_q_senderDestroyed()" "\0" __FILE__ ":" "141")); | - | ||||||
34 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||
35 | - | |||||||
36 | - | |||||||
37 | - | |||||||
38 | - | |||||||
39 | - | |||||||
40 | - | |||||||
41 | - | |||||||
42 | void QSignalMapper::setMapping(QObject *sender, const QString &text) | - | ||||||
43 | { | - | ||||||
44 | QSignalMapperPrivate * const d = d_func(); | - | ||||||
45 | d->stringHash.insert(sender, text); | - | ||||||
46 | connect(sender, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "154"), this, qFlagLocation("1""_q_senderDestroyed()" "\0" __FILE__ ":" "154")); | - | ||||||
47 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||
48 | - | |||||||
49 | - | |||||||
50 | - | |||||||
51 | - | |||||||
52 | - | |||||||
53 | - | |||||||
54 | - | |||||||
55 | void QSignalMapper::setMapping(QObject *sender, QWidget *widget) | - | ||||||
56 | { | - | ||||||
57 | QSignalMapperPrivate * const d = d_func(); | - | ||||||
58 | d->widgetHash.insert(sender, widget); | - | ||||||
59 | connect(sender, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "167"), this, qFlagLocation("1""_q_senderDestroyed()" "\0" __FILE__ ":" "167")); | - | ||||||
60 | } never executed: end of block | 0 | ||||||
61 | - | |||||||
62 | - | |||||||
63 | - | |||||||
64 | - | |||||||
65 | - | |||||||
66 | - | |||||||
67 | - | |||||||
68 | void QSignalMapper::setMapping(QObject *sender, QObject *object) | - | ||||||
69 | { | - | ||||||
70 | QSignalMapperPrivate * const d = d_func(); | - | ||||||
71 | d->objectHash.insert(sender, object); | - | ||||||
72 | connect(sender, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "180"), this, qFlagLocation("1""_q_senderDestroyed()" "\0" __FILE__ ":" "180")); | - | ||||||
73 | } never executed: end of block | 0 | ||||||
74 | - | |||||||
75 | - | |||||||
76 | - | |||||||
77 | - | |||||||
78 | - | |||||||
79 | - | |||||||
80 | QObject *QSignalMapper::mapping(int id) const | - | ||||||
81 | { | - | ||||||
82 | const QSignalMapperPrivate * const d = d_func(); | - | ||||||
83 | return never executed: d->intHash.key(id);return d->intHash.key(id); never executed: return d->intHash.key(id); | 0 | ||||||
84 | } | - | ||||||
85 | - | |||||||
86 | - | |||||||
87 | - | |||||||
88 | - | |||||||
89 | QObject *QSignalMapper::mapping(const QString &id) const | - | ||||||
90 | { | - | ||||||
91 | const QSignalMapperPrivate * const d = d_func(); | - | ||||||
92 | return never executed: d->stringHash.key(id);return d->stringHash.key(id); never executed: return d->stringHash.key(id); | 0 | ||||||
93 | } | - | ||||||
94 | - | |||||||
95 | - | |||||||
96 | - | |||||||
97 | - | |||||||
98 | - | |||||||
99 | - | |||||||
100 | QObject *QSignalMapper::mapping(QWidget *widget) const | - | ||||||
101 | { | - | ||||||
102 | const QSignalMapperPrivate * const d = d_func(); | - | ||||||
103 | return never executed: d->widgetHash.key(widget);return d->widgetHash.key(widget); never executed: return d->widgetHash.key(widget); | 0 | ||||||
104 | } | - | ||||||
105 | - | |||||||
106 | - | |||||||
107 | - | |||||||
108 | - | |||||||
109 | - | |||||||
110 | - | |||||||
111 | QObject *QSignalMapper::mapping(QObject *object) const | - | ||||||
112 | { | - | ||||||
113 | const QSignalMapperPrivate * const d = d_func(); | - | ||||||
114 | return never executed: d->objectHash.key(object);return d->objectHash.key(object); never executed: return d->objectHash.key(object); | 0 | ||||||
115 | } | - | ||||||
116 | void QSignalMapper::removeMappings(QObject *sender) | - | ||||||
117 | { | - | ||||||
118 | QSignalMapperPrivate * const d = d_func(); | - | ||||||
119 | - | |||||||
120 | d->intHash.remove(sender); | - | ||||||
121 | d->stringHash.remove(sender); | - | ||||||
122 | d->widgetHash.remove(sender); | - | ||||||
123 | d->objectHash.remove(sender); | - | ||||||
124 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||
125 | - | |||||||
126 | - | |||||||
127 | - | |||||||
128 | - | |||||||
129 | void QSignalMapper::map() { map(sender()); } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||
130 | - | |||||||
131 | - | |||||||
132 | - | |||||||
133 | - | |||||||
134 | void QSignalMapper::map(QObject *sender) | - | ||||||
135 | { | - | ||||||
136 | QSignalMapperPrivate * const d = d_func(); | - | ||||||
137 | if (d->intHash.contains(sender)
| 1-2 | ||||||
138 | mapped(d->intHash.value(sender)); executed 2 times by 1 test: mapped(d->intHash.value(sender)); Executed by:
| 2 | ||||||
139 | if (d->stringHash.contains(sender)
| 1-2 | ||||||
140 | mapped(d->stringHash.value(sender)); executed 2 times by 1 test: mapped(d->stringHash.value(sender)); Executed by:
| 2 | ||||||
141 | if (d->widgetHash.contains(sender)
| 0-3 | ||||||
142 | mapped(d->widgetHash.value(sender)); never executed: mapped(d->widgetHash.value(sender)); | 0 | ||||||
143 | if (d->objectHash.contains(sender)
| 0-3 | ||||||
144 | mapped(d->objectHash.value(sender)); never executed: mapped(d->objectHash.value(sender)); | 0 | ||||||
145 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||
146 | - | |||||||
147 | - | |||||||
Switch to Source code | Preprocessed file |