OpenCoverage

qsignalmapper.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/kernel/qsignalmapper.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4class 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;-
7public:-
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:
  • tst_QSignalMapper
5
12 QHash<QObject *, int> intHash;-
13 QHash<QObject *, QString> stringHash;-
14 QHash<QObject *, QWidget*> widgetHash;-
15 QHash<QObject *, QObject*> objectHash;-
16-
17};-
18QSignalMapper::QSignalMapper(QObject* parent)-
19 : QObject(*new QSignalMapperPrivate, parent)-
20{-
21}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSignalMapper
1
22-
23-
24-
25-
26QSignalMapper::~QSignalMapper()-
27{-
28}-
29void 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:
  • tst_QSignalMapper
3
35-
36-
37-
38-
39-
40-
41-
42void 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:
  • tst_QSignalMapper
2
48-
49-
50-
51-
52-
53-
54-
55void 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-
68void 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-
80QObject *QSignalMapper::mapping(int id) const-
81{-
82 const QSignalMapperPrivate * const d = d_func();-
83 return
never executed: return d->intHash.key(id);
d->intHash.key(id);
never executed: return d->intHash.key(id);
0
84}-
85-
86-
87-
88-
89QObject *QSignalMapper::mapping(const QString &id) const-
90{-
91 const QSignalMapperPrivate * const d = d_func();-
92 return
never executed: return d->stringHash.key(id);
d->stringHash.key(id);
never executed: return d->stringHash.key(id);
0
93}-
94-
95-
96-
97-
98-
99-
100QObject *QSignalMapper::mapping(QWidget *widget) const-
101{-
102 const QSignalMapperPrivate * const d = d_func();-
103 return
never executed: return d->widgetHash.key(widget);
d->widgetHash.key(widget);
never executed: return d->widgetHash.key(widget);
0
104}-
105-
106-
107-
108-
109-
110-
111QObject *QSignalMapper::mapping(QObject *object) const-
112{-
113 const QSignalMapperPrivate * const d = d_func();-
114 return
never executed: return d->objectHash.key(object);
d->objectHash.key(object);
never executed: return d->objectHash.key(object);
0
115}-
116void 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:
  • tst_QSignalMapper
5
125-
126-
127-
128-
129void QSignalMapper::map() { map(sender()); }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QSignalMapper
3
130-
131-
132-
133-
134void QSignalMapper::map(QObject *sender)-
135{-
136 QSignalMapperPrivate * const d = d_func();-
137 if (d->intHash.contains(sender)
d->intHash.contains(sender)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSignalMapper
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSignalMapper
)
1-2
138 mapped(d->intHash.value(sender));
executed 2 times by 1 test: mapped(d->intHash.value(sender));
Executed by:
  • tst_QSignalMapper
2
139 if (d->stringHash.contains(sender)
d->stringHash.contains(sender)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSignalMapper
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSignalMapper
)
1-2
140 mapped(d->stringHash.value(sender));
executed 2 times by 1 test: mapped(d->stringHash.value(sender));
Executed by:
  • tst_QSignalMapper
2
141 if (d->widgetHash.contains(sender)
d->widgetHash.contains(sender)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSignalMapper
)
0-3
142 mapped(d->widgetHash.value(sender));
never executed: mapped(d->widgetHash.value(sender));
0
143 if (d->objectHash.contains(sender)
d->objectHash.contains(sender)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSignalMapper
)
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:
  • tst_QSignalMapper
3
146-
147-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9