Line | Source Code | Coverage |
---|
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: } Execution Count:5 | 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: } Execution Count:1 | 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, "2""destroyed()", this, "1""_q_senderDestroyed()"); | - |
34 | } executed: } Execution Count:3 | 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, "2""destroyed()", this, "1""_q_senderDestroyed()"); | - |
47 | } executed: } Execution Count:2 | 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, "2""destroyed()", this, "1""_q_senderDestroyed()"); | - |
60 | } | 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, "2""destroyed()", this, "1""_q_senderDestroyed()"); | - |
73 | } | 0 |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | | - |
80 | QObject *QSignalMapper::mapping(int id) const | - |
81 | { | - |
82 | const QSignalMapperPrivate * const d = d_func(); | - |
83 | 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 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 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 d->objectHash.key(object); never executed: return d->objectHash.key(object); | 0 |
115 | } | - |
116 | | - |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | void QSignalMapper::removeMappings(QObject *sender) | - |
123 | { | - |
124 | QSignalMapperPrivate * const d = d_func(); | - |
125 | | - |
126 | d->intHash.remove(sender); | - |
127 | d->stringHash.remove(sender); | - |
128 | d->widgetHash.remove(sender); | - |
129 | d->objectHash.remove(sender); | - |
130 | } executed: } Execution Count:5 | 5 |
131 | | - |
132 | | - |
133 | | - |
134 | | - |
135 | void QSignalMapper::map() { map(sender()); } executed: } Execution Count:3 | 3 |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | void QSignalMapper::map(QObject *sender) | - |
141 | { | - |
142 | QSignalMapperPrivate * const d = d_func(); | - |
143 | if (d->intHash.contains(sender)) evaluated: d->intHash.contains(sender) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
144 | mapped(d->intHash.value(sender)); executed: mapped(d->intHash.value(sender)); Execution Count:2 | 2 |
145 | if (d->stringHash.contains(sender)) evaluated: d->stringHash.contains(sender) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
146 | mapped(d->stringHash.value(sender)); executed: mapped(d->stringHash.value(sender)); Execution Count:2 | 2 |
147 | if (d->widgetHash.contains(sender)) partially evaluated: d->widgetHash.contains(sender) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
148 | mapped(d->widgetHash.value(sender)); never executed: mapped(d->widgetHash.value(sender)); | 0 |
149 | if (d->objectHash.contains(sender)) partially evaluated: d->objectHash.contains(sender) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
150 | mapped(d->objectHash.value(sender)); never executed: mapped(d->objectHash.value(sender)); | 0 |
151 | } executed: } Execution Count:3 | 3 |
152 | | - |
153 | | - |
154 | | - |
| | |