kernel/qaction.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11 -
12 -
13 -
14 -
15static QString qt_strippedText(QString s) -
16{ -
17 s.remove( QString::fromLatin1("...") ); -
18 int i = 0; -
19 while (i < s.size()) {
evaluated: i < s.size()
TRUEFALSE
yes
Evaluation Count:235
yes
Evaluation Count:39
39-235
20 ++i; -
21 if (s.at(i-1) != QLatin1Char('&'))
evaluated: s.at(i-1) != QLatin1Char('&')
TRUEFALSE
yes
Evaluation Count:233
yes
Evaluation Count:2
2-233
22 continue;
executed: continue;
Execution Count:233
233
23 if (i < s.size() && s.at(i) == QLatin1Char('&'))
partially evaluated: i < s.size()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
evaluated: s.at(i) == QLatin1Char('&')
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
0-2
24 ++i;
executed: ++i;
Execution Count:1
1
25 s.remove(i-1,1); -
26 }
executed: }
Execution Count:2
2
27 return s.trimmed();
executed: return s.trimmed();
Execution Count:39
39
28} -
29 -
30 -
31QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0), -
32 visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false), -
33 iconVisibleInMenu(-1), -
34 menuRole(QAction::TextHeuristicRole), -
35 priority(QAction::NormalPriority) -
36{ -
37 -
38 shortcutId = 0; -
39 shortcutContext = Qt::WindowShortcut; -
40 autorepeat = true; -
41 -
42}
executed: }
Execution Count:3599
3599
43 -
44QActionPrivate::~QActionPrivate() -
45{ -
46} -
47 -
48bool QActionPrivate::showStatusText(QWidget *widget, const QString &str) -
49{ -
50 -
51 -
52 -
53 -
54 if(QObject *object = widget ? widget : parent) {
evaluated: widget
TRUEFALSE
yes
Evaluation Count:74
yes
Evaluation Count:44
44-74
55 QStatusTipEvent tip(str); -
56 QApplication::sendEvent(object, &tip); -
57 return true;
executed: return true;
Execution Count:105
105
58 } -
59 -
60 return false;
executed: return false;
Execution Count:13
13
61} -
62 -
63void QActionPrivate::sendDataChanged() -
64{ -
65 QAction * const q = q_func(); -
66 QActionEvent e(QEvent::ActionChanged, q); -
67 for (int i = 0; i < widgets.size(); ++i) {
evaluated: i < widgets.size()
TRUEFALSE
yes
Evaluation Count:9495
yes
Evaluation Count:9939
9495-9939
68 QWidget *w = widgets.at(i); -
69 QApplication::sendEvent(w, &e); -
70 }
executed: }
Execution Count:9495
9495
71 -
72 for (int i = 0; i < graphicsWidgets.size(); ++i) {
partially evaluated: i < graphicsWidgets.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9939
0-9939
73 QGraphicsWidget *w = graphicsWidgets.at(i); -
74 QApplication::sendEvent(w, &e); -
75 }
never executed: }
0
76 -
77 QApplication::sendEvent(q, &e); -
78 -
79 q->changed(); -
80}
executed: }
Execution Count:9939
9939
81 -
82 -
83void QActionPrivate::redoGrab(QShortcutMap &map) -
84{ -
85 QAction * const q = q_func(); -
86 if (shortcutId)
evaluated: shortcutId
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:578
7-578
87 map.removeShortcut(shortcutId, q);
executed: map.removeShortcut(shortcutId, q);
Execution Count:7
7
88 if (shortcut.isEmpty())
evaluated: shortcut.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:584
1-584
89 return;
executed: return;
Execution Count:1
1
90 shortcutId = map.addShortcut(q, shortcut, shortcutContext, qWidgetShortcutContextMatcher); -
91 if (!enabled)
evaluated: !enabled
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:583
1-583
92 map.setShortcutEnabled(false, shortcutId, q);
executed: map.setShortcutEnabled(false, shortcutId, q);
Execution Count:1
1
93 if (!autorepeat)
evaluated: !autorepeat
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:583
1-583
94 map.setShortcutAutoRepeat(false, shortcutId, q);
executed: map.setShortcutAutoRepeat(false, shortcutId, q);
Execution Count:1
1
95}
executed: }
Execution Count:584
584
96 -
97void QActionPrivate::redoGrabAlternate(QShortcutMap &map) -
98{ -
99 QAction * const q = q_func(); -
100 for(int i = 0; i < alternateShortcutIds.count(); ++i) {
evaluated: i < alternateShortcutIds.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:106
1-106
101 if (const int id = alternateShortcutIds.at(i))
partially evaluated: const int id = alternateShortcutIds.at(i)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
102 map.removeShortcut(id, q);
executed: map.removeShortcut(id, q);
Execution Count:1
1
103 }
executed: }
Execution Count:1
1
104 alternateShortcutIds.clear(); -
105 if (alternateShortcuts.isEmpty())
evaluated: alternateShortcuts.isEmpty()
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:3
3-103
106 return;
executed: return;
Execution Count:103
103
107 for(int i = 0; i < alternateShortcuts.count(); ++i) {
evaluated: i < alternateShortcuts.count()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3
3-4
108 const QKeySequence& alternate = alternateShortcuts.at(i); -
109 if (!alternate.isEmpty())
partially evaluated: !alternate.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
110 alternateShortcutIds.append(map.addShortcut(q, alternate, shortcutContext, qWidgetShortcutContextMatcher));
executed: alternateShortcutIds.append(map.addShortcut(q, alternate, shortcutContext, qWidgetShortcutContextMatcher));
Execution Count:4
4
111 else -
112 alternateShortcutIds.append(0);
never executed: alternateShortcutIds.append(0);
0
113 } -
114 if (!enabled) {
partially evaluated: !enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
115 for(int i = 0; i < alternateShortcutIds.count(); ++i) {
never evaluated: i < alternateShortcutIds.count()
0
116 const int id = alternateShortcutIds.at(i); -
117 map.setShortcutEnabled(false, id, q); -
118 }
never executed: }
0
119 }
never executed: }
0
120 if (!autorepeat) {
evaluated: !autorepeat
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
121 for(int i = 0; i < alternateShortcutIds.count(); ++i) {
evaluated: i < alternateShortcutIds.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
122 const int id = alternateShortcutIds.at(i); -
123 map.setShortcutAutoRepeat(false, id, q); -
124 }
executed: }
Execution Count:1
1
125 }
executed: }
Execution Count:1
1
126}
executed: }
Execution Count:3
3
127 -
128void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) -
129{ -
130 QAction * const q = q_func(); -
131 if (shortcutId)
evaluated: shortcutId
TRUEFALSE
yes
Evaluation Count:579
yes
Evaluation Count:4765
579-4765
132 map.setShortcutEnabled(enable, shortcutId, q);
executed: map.setShortcutEnabled(enable, shortcutId, q);
Execution Count:579
579
133 for(int i = 0; i < alternateShortcutIds.count(); ++i) {
partially evaluated: i < alternateShortcutIds.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5344
0-5344
134 if (const int id = alternateShortcutIds.at(i))
never evaluated: const int id = alternateShortcutIds.at(i)
0
135 map.setShortcutEnabled(enable, id, q);
never executed: map.setShortcutEnabled(enable, id, q);
0
136 }
never executed: }
0
137}
executed: }
Execution Count:5344
5344
138QAction::QAction(QObject* parent) -
139 : QObject(*(new QActionPrivate), parent) -
140{ -
141 QActionPrivate * const d = d_func(); -
142 d->group = qobject_cast<QActionGroup *>(parent); -
143 if (d->group)
evaluated: d->group
TRUEFALSE
yes
Evaluation Count:581
yes
Evaluation Count:1614
581-1614
144 d->group->addAction(this);
executed: d->group->addAction(this);
Execution Count:581
581
145}
executed: }
Execution Count:2195
2195
146QAction::QAction(const QString &text, QObject* parent) -
147 : QObject(*(new QActionPrivate), parent) -
148{ -
149 QActionPrivate * const d = d_func(); -
150 d->text = text; -
151 d->group = qobject_cast<QActionGroup *>(parent); -
152 if (d->group)
evaluated: d->group
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1382
2-1382
153 d->group->addAction(this);
executed: d->group->addAction(this);
Execution Count:2
2
154}
executed: }
Execution Count:1384
1384
155QAction::QAction(const QIcon &icon, const QString &text, QObject* parent) -
156 : QObject(*(new QActionPrivate), parent) -
157{ -
158 QActionPrivate * const d = d_func(); -
159 d->icon = icon; -
160 d->text = text; -
161 d->group = qobject_cast<QActionGroup *>(parent); -
162 if (d->group)
partially evaluated: d->group
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
163 d->group->addAction(this);
never executed: d->group->addAction(this);
0
164}
executed: }
Execution Count:2
2
165 -
166 -
167 -
168 -
169QAction::QAction(QActionPrivate &dd, QObject *parent) -
170 : QObject(dd, parent) -
171{ -
172 QActionPrivate * const d = d_func(); -
173 d->group = qobject_cast<QActionGroup *>(parent); -
174 if (d->group)
partially evaluated: d->group
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
175 d->group->addAction(this);
never executed: d->group->addAction(this);
0
176}
executed: }
Execution Count:18
18
177 -
178 -
179 -
180 -
181QWidget *QAction::parentWidget() const -
182{ -
183 QObject *ret = parent(); -
184 while (ret && !ret->isWidgetType())
never evaluated: ret
never evaluated: !ret->isWidgetType()
0
185 ret = ret->parent();
never executed: ret = ret->parent();
0
186 return (QWidget*)ret;
never executed: return (QWidget*)ret;
0
187} -
188 -
189 -
190 -
191 -
192 -
193 -
194 -
195QList<QWidget *> QAction::associatedWidgets() const -
196{ -
197 const QActionPrivate * const d = d_func(); -
198 return d->widgets;
executed: return d->widgets;
Execution Count:6
6
199} -
200QList<QGraphicsWidget *> QAction::associatedGraphicsWidgets() const -
201{ -
202 const QActionPrivate * const d = d_func(); -
203 return d->graphicsWidgets;
never executed: return d->graphicsWidgets;
0
204} -
205void QAction::setShortcut(const QKeySequence &shortcut) -
206{ -
207 if (!(static_cast<QApplication *>(QCoreApplication::instance()))) { QMessageLogger("kernel/qaction.cpp", 402, __PRETTY_FUNCTION__).warning("QAction: Initialize QApplication before calling '" "setShortcut" "'."); return; };
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1198
never executed: return;
0-1198
208 -
209 QActionPrivate * const d = d_func(); -
210 if (d->shortcut == shortcut)
evaluated: d->shortcut == shortcut
TRUEFALSE
yes
Evaluation Count:719
yes
Evaluation Count:479
479-719
211 return;
executed: return;
Execution Count:719
719
212 -
213 d->shortcut = shortcut; -
214 d->redoGrab((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
215 d->sendDataChanged(); -
216}
executed: }
Execution Count:479
479
217void QAction::setShortcuts(const QList<QKeySequence> &shortcuts) -
218{ -
219 QActionPrivate * const d = d_func(); -
220 -
221 QList <QKeySequence> listCopy = shortcuts; -
222 -
223 QKeySequence primary; -
224 if (!listCopy.isEmpty())
evaluated: !listCopy.isEmpty()
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:1
1-104
225 primary = listCopy.takeFirst();
executed: primary = listCopy.takeFirst();
Execution Count:104
104
226 -
227 if (d->shortcut == primary && d->alternateShortcuts == listCopy)
partially evaluated: d->shortcut == primary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:105
never evaluated: d->alternateShortcuts == listCopy
0-105
228 return;
never executed: return;
0
229 -
230 if (!(static_cast<QApplication *>(QCoreApplication::instance()))) { QMessageLogger("kernel/qaction.cpp", 434, __PRETTY_FUNCTION__).warning("QAction: Initialize QApplication before calling '" "setShortcuts" "'."); return; };
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:105
never executed: return;
0-105
231 -
232 d->shortcut = primary; -
233 d->alternateShortcuts = listCopy; -
234 d->redoGrab((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
235 d->redoGrabAlternate((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
236 d->sendDataChanged(); -
237}
executed: }
Execution Count:105
105
238void QAction::setShortcuts(QKeySequence::StandardKey key) -
239{ -
240 QList <QKeySequence> list = QKeySequence::keyBindings(key); -
241 setShortcuts(list); -
242}
executed: }
Execution Count:103
103
243 -
244 -
245 -
246 -
247 -
248 -
249QKeySequence QAction::shortcut() const -
250{ -
251 const QActionPrivate * const d = d_func(); -
252 return d->shortcut;
executed: return d->shortcut;
Execution Count:3824
3824
253} -
254QList<QKeySequence> QAction::shortcuts() const -
255{ -
256 const QActionPrivate * const d = d_func(); -
257 QList <QKeySequence> shortcuts; -
258 if (!d->shortcut.isEmpty())
partially evaluated: !d->shortcut.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
259 shortcuts << d->shortcut;
executed: shortcuts << d->shortcut;
Execution Count:2
2
260 if (!d->alternateShortcuts.isEmpty())
partially evaluated: !d->alternateShortcuts.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
261 shortcuts << d->alternateShortcuts;
executed: shortcuts << d->alternateShortcuts;
Execution Count:2
2
262 return shortcuts;
executed: return shortcuts;
Execution Count:2
2
263} -
264void QAction::setShortcutContext(Qt::ShortcutContext context) -
265{ -
266 QActionPrivate * const d = d_func(); -
267 if (d->shortcutContext == context)
never evaluated: d->shortcutContext == context
0
268 return;
never executed: return;
0
269 if (!(static_cast<QApplication *>(QCoreApplication::instance()))) { QMessageLogger("kernel/qaction.cpp", 501, __PRETTY_FUNCTION__).warning("QAction: Initialize QApplication before calling '" "setShortcutContext" "'."); return; };
never evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))
never executed: return;
0
270 d->shortcutContext = context; -
271 d->redoGrab((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
272 d->redoGrabAlternate((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
273 d->sendDataChanged(); -
274}
never executed: }
0
275 -
276Qt::ShortcutContext QAction::shortcutContext() const -
277{ -
278 const QActionPrivate * const d = d_func(); -
279 return d->shortcutContext;
never executed: return d->shortcutContext;
0
280} -
281void QAction::setAutoRepeat(bool on) -
282{ -
283 QActionPrivate * const d = d_func(); -
284 if (d->autorepeat == on)
evaluated: d->autorepeat == on
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
285 return;
executed: return;
Execution Count:1
1
286 if (!(static_cast<QApplication *>(QCoreApplication::instance()))) { QMessageLogger("kernel/qaction.cpp", 529, __PRETTY_FUNCTION__).warning("QAction: Initialize QApplication before calling '" "setAutoRepeat" "'."); return; };
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never executed: return;
0-1
287 d->autorepeat = on; -
288 d->redoGrab((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
289 d->redoGrabAlternate((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
290 d->sendDataChanged(); -
291}
executed: }
Execution Count:1
1
292 -
293bool QAction::autoRepeat() const -
294{ -
295 const QActionPrivate * const d = d_func(); -
296 return d->autorepeat;
never executed: return d->autorepeat;
0
297} -
298void QAction::setFont(const QFont &font) -
299{ -
300 QActionPrivate * const d = d_func(); -
301 if (d->font == font)
partially evaluated: d->font == font
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
302 return;
never executed: return;
0
303 -
304 d->fontSet = true; -
305 d->font = font; -
306 d->sendDataChanged(); -
307}
executed: }
Execution Count:1
1
308 -
309QFont QAction::font() const -
310{ -
311 const QActionPrivate * const d = d_func(); -
312 return d->font;
executed: return d->font;
Execution Count:2008
2008
313} -
314 -
315 -
316 -
317 -
318 -
319QAction::~QAction() -
320{ -
321 QActionPrivate * const d = d_func(); -
322 for (int i = d->widgets.size()-1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:3587
62-3587
323 QWidget *w = d->widgets.at(i); -
324 w->removeAction(this); -
325 }
executed: }
Execution Count:62
62
326 -
327 for (int i = d->graphicsWidgets.size()-1; i >= 0; --i) {
partially evaluated: i >= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3587
0-3587
328 QGraphicsWidget *w = d->graphicsWidgets.at(i); -
329 w->removeAction(this); -
330 }
never executed: }
0
331 -
332 if (d->group)
evaluated: d->group
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3583
4-3583
333 d->group->removeAction(this);
executed: d->group->removeAction(this);
Execution Count:4
4
334 -
335 if (d->shortcutId && (static_cast<QApplication *>(QCoreApplication::instance()))) {
evaluated: d->shortcutId
TRUEFALSE
yes
Evaluation Count:576
yes
Evaluation Count:3011
partially evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))
TRUEFALSE
yes
Evaluation Count:576
no
Evaluation Count:0
0-3011
336 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(d->shortcutId, this); -
337 for(int i = 0; i < d->alternateShortcutIds.count(); ++i) {
evaluated: i < d->alternateShortcutIds.count()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:576
3-576
338 const int id = d->alternateShortcutIds.at(i); -
339 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(id, this); -
340 }
executed: }
Execution Count:3
3
341 }
executed: }
Execution Count:576
576
342 -
343}
executed: }
Execution Count:3587
3587
344void QAction::setActionGroup(QActionGroup *group) -
345{ -
346 QActionPrivate * const d = d_func(); -
347 if(group == d->group)
partially evaluated: group == d->group
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
348 return;
never executed: return;
0
349 -
350 if(d->group)
evaluated: d->group
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
351 d->group->removeAction(this);
executed: d->group->removeAction(this);
Execution Count:1
1
352 d->group = group; -
353 if(group)
evaluated: group
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
354 group->addAction(this);
executed: group->addAction(this);
Execution Count:1
1
355}
executed: }
Execution Count:2
2
356 -
357 -
358 -
359 -
360 -
361 -
362 -
363QActionGroup *QAction::actionGroup() const -
364{ -
365 const QActionPrivate * const d = d_func(); -
366 return d->group;
executed: return d->group;
Execution Count:23
23
367} -
368void QAction::setIcon(const QIcon &icon) -
369{ -
370 QActionPrivate * const d = d_func(); -
371 d->icon = icon; -
372 d->sendDataChanged(); -
373}
executed: }
Execution Count:408
408
374 -
375QIcon QAction::icon() const -
376{ -
377 const QActionPrivate * const d = d_func(); -
378 return d->icon;
executed: return d->icon;
Execution Count:6458
6458
379} -
380QMenu *QAction::menu() const -
381{ -
382 const QActionPrivate * const d = d_func(); -
383 return d->menu;
executed: return d->menu;
Execution Count:4595
4595
384} -
385 -
386 -
387 -
388 -
389void QAction::setMenu(QMenu *menu) -
390{ -
391 QActionPrivate * const d = d_func(); -
392 if (d->menu)
evaluated: d->menu
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
393 d->menu->d_func()->setOverrideMenuAction(0);
executed: d->menu->d_func()->setOverrideMenuAction(0);
Execution Count:1
1
394 d->menu = menu; -
395 if (menu)
evaluated: menu
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
396 menu->d_func()->setOverrideMenuAction(this);
executed: menu->d_func()->setOverrideMenuAction(this);
Execution Count:3
3
397 d->sendDataChanged(); -
398}
executed: }
Execution Count:4
4
399void QAction::setSeparator(bool b) -
400{ -
401 QActionPrivate * const d = d_func(); -
402 if (d->separator == b)
partially evaluated: d->separator == b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:127
0-127
403 return;
never executed: return;
0
404 -
405 d->separator = b; -
406 d->sendDataChanged(); -
407}
executed: }
Execution Count:127
127
408 -
409 -
410 -
411 -
412 -
413 -
414 -
415bool QAction::isSeparator() const -
416{ -
417 const QActionPrivate * const d = d_func(); -
418 return d->separator;
executed: return d->separator;
Execution Count:8722
8722
419} -
420void QAction::setText(const QString &text) -
421{ -
422 QActionPrivate * const d = d_func(); -
423 if (d->text == text)
evaluated: d->text == text
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:1578
130-1578
424 return;
executed: return;
Execution Count:130
130
425 -
426 d->text = text; -
427 d->sendDataChanged(); -
428}
executed: }
Execution Count:1578
1578
429 -
430QString QAction::text() const -
431{ -
432 const QActionPrivate * const d = d_func(); -
433 QString s = d->text; -
434 if(s.isEmpty()) {
evaluated: s.isEmpty()
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:4947
213-4947
435 s = d->iconText; -
436 s.replace(QLatin1Char('&'), QLatin1String("&&")); -
437 }
executed: }
Execution Count:213
213
438 return s;
executed: return s;
Execution Count:5160
5160
439} -
440void QAction::setIconText(const QString &text) -
441{ -
442 QActionPrivate * const d = d_func(); -
443 if (d->iconText == text)
partially evaluated: d->iconText == text
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
444 return;
never executed: return;
0
445 -
446 d->iconText = text; -
447 d->sendDataChanged(); -
448}
executed: }
Execution Count:3
3
449 -
450QString QAction::iconText() const -
451{ -
452 const QActionPrivate * const d = d_func(); -
453 if (d->iconText.isEmpty())
evaluated: d->iconText.isEmpty()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:3
3-21
454 return qt_strippedText(d->text);
executed: return qt_strippedText(d->text);
Execution Count:21
21
455 return d->iconText;
executed: return d->iconText;
Execution Count:3
3
456} -
457void QAction::setToolTip(const QString &tooltip) -
458{ -
459 QActionPrivate * const d = d_func(); -
460 if (d->tooltip == tooltip)
partially evaluated: d->tooltip == tooltip
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
461 return;
never executed: return;
0
462 -
463 d->tooltip = tooltip; -
464 d->sendDataChanged(); -
465}
executed: }
Execution Count:1
1
466 -
467QString QAction::toolTip() const -
468{ -
469 const QActionPrivate * const d = d_func(); -
470 if (d->tooltip.isEmpty()) {
evaluated: d->tooltip.isEmpty()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:1
1-18
471 if (!d->text.isEmpty())
evaluated: !d->text.isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:4
4-14
472 return qt_strippedText(d->text);
executed: return qt_strippedText(d->text);
Execution Count:14
14
473 return qt_strippedText(d->iconText);
executed: return qt_strippedText(d->iconText);
Execution Count:4
4
474 } -
475 return d->tooltip;
executed: return d->tooltip;
Execution Count:1
1
476} -
477void QAction::setStatusTip(const QString &statustip) -
478{ -
479 QActionPrivate * const d = d_func(); -
480 if (d->statustip == statustip)
partially evaluated: d->statustip == statustip
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
481 return;
never executed: return;
0
482 -
483 d->statustip = statustip; -
484 d->sendDataChanged(); -
485}
executed: }
Execution Count:2
2
486 -
487QString QAction::statusTip() const -
488{ -
489 const QActionPrivate * const d = d_func(); -
490 return d->statustip;
executed: return d->statustip;
Execution Count:111
111
491} -
492void QAction::setWhatsThis(const QString &whatsthis) -
493{ -
494 QActionPrivate * const d = d_func(); -
495 if (d->whatsthis == whatsthis)
never evaluated: d->whatsthis == whatsthis
0
496 return;
never executed: return;
0
497 -
498 d->whatsthis = whatsthis; -
499 d->sendDataChanged(); -
500}
never executed: }
0
501 -
502QString QAction::whatsThis() const -
503{ -
504 const QActionPrivate * const d = d_func(); -
505 return d->whatsthis;
executed: return d->whatsthis;
Execution Count:18
18
506} -
507void QAction::setPriority(Priority priority) -
508{ -
509 QActionPrivate * const d = d_func(); -
510 if (d->priority == priority)
partially evaluated: d->priority == priority
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
511 return;
never executed: return;
0
512 -
513 d->priority = priority; -
514 d->sendDataChanged(); -
515}
executed: }
Execution Count:2
2
516 -
517QAction::Priority QAction::priority() const -
518{ -
519 const QActionPrivate * const d = d_func(); -
520 return d->priority;
executed: return d->priority;
Execution Count:4
4
521} -
522void QAction::setCheckable(bool b) -
523{ -
524 QActionPrivate * const d = d_func(); -
525 if (d->checkable == b)
partially evaluated: d->checkable == b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:912
0-912
526 return;
never executed: return;
0
527 -
528 d->checkable = b; -
529 d->checked = false; -
530 d->sendDataChanged(); -
531}
executed: }
Execution Count:912
912
532 -
533bool QAction::isCheckable() const -
534{ -
535 const QActionPrivate * const d = d_func(); -
536 return d->checkable;
executed: return d->checkable;
Execution Count:3891
3891
537} -
538 -
539 -
540 -
541 -
542 -
543 -
544 -
545void QAction::toggle() -
546{ -
547 QActionPrivate * const d = d_func(); -
548 setChecked(!d->checked); -
549}
never executed: }
0
550void QAction::setChecked(bool b) -
551{ -
552 QActionPrivate * const d = d_func(); -
553 if (!d->checkable || d->checked == b)
partially evaluated: !d->checkable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1099
evaluated: d->checked == b
TRUEFALSE
yes
Evaluation Count:451
yes
Evaluation Count:648
0-1099
554 return;
executed: return;
Execution Count:451
451
555 -
556 QPointer<QAction> guard(this); -
557 d->checked = b; -
558 d->sendDataChanged(); -
559 if (guard)
partially evaluated: guard
TRUEFALSE
yes
Evaluation Count:648
no
Evaluation Count:0
0-648
560 toggled(b);
executed: toggled(b);
Execution Count:648
648
561}
executed: }
Execution Count:648
648
562 -
563bool QAction::isChecked() const -
564{ -
565 const QActionPrivate * const d = d_func(); -
566 return d->checked;
executed: return d->checked;
Execution Count:687
687
567} -
568void QAction::setEnabled(bool b) -
569{ -
570 QActionPrivate * const d = d_func(); -
571 if (b == d->enabled && b != d->forceDisabled)
evaluated: b == d->enabled
TRUEFALSE
yes
Evaluation Count:8490
yes
Evaluation Count:1312
evaluated: b != d->forceDisabled
TRUEFALSE
yes
Evaluation Count:8489
yes
Evaluation Count:1
1-8490
572 return;
executed: return;
Execution Count:8489
8489
573 d->forceDisabled = !b; -
574 if (b && (!d->visible || (d->group && !d->group->isEnabled())))
evaluated: b
TRUEFALSE
yes
Evaluation Count:369
yes
Evaluation Count:944
evaluated: !d->visible
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:367
evaluated: d->group
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:363
evaluated: !d->group->isEnabled()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-944
575 return;
executed: return;
Execution Count:3
3
576 if (!(static_cast<QApplication *>(QCoreApplication::instance()))) { QMessageLogger("kernel/qaction.cpp", 1039, __PRETTY_FUNCTION__).warning("QAction: Initialize QApplication before calling '" "setEnabled" "'."); return; };
never executed: return;
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1310
0-1310
577 d->enabled = b; -
578 -
579 d->setShortcutEnabled(b, (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
580 -
581 d->sendDataChanged(); -
582}
executed: }
Execution Count:1310
1310
583 -
584bool QAction::isEnabled() const -
585{ -
586 const QActionPrivate * const d = d_func(); -
587 return d->enabled;
executed: return d->enabled;
Execution Count:2773
2773
588} -
589void QAction::setVisible(bool b) -
590{ -
591 QActionPrivate * const d = d_func(); -
592 if (b == d->visible && b != d->forceInvisible)
evaluated: b == d->visible
TRUEFALSE
yes
Evaluation Count:612
yes
Evaluation Count:4033
evaluated: b != d->forceInvisible
TRUEFALSE
yes
Evaluation Count:611
yes
Evaluation Count:1
1-4033
593 return;
executed: return;
Execution Count:611
611
594 if (!(static_cast<QApplication *>(QCoreApplication::instance()))) { QMessageLogger("kernel/qaction.cpp", 1071, __PRETTY_FUNCTION__).warning("QAction: Initialize QApplication before calling '" "setVisible" "'."); return; };
never executed: return;
partially evaluated: !(static_cast<QApplication *>(QCoreApplication::instance()))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4034
0-4034
595 d->forceInvisible = !b; -
596 d->visible = b; -
597 d->enabled = b && !d->forceDisabled && (!d->group || d->group->isEnabled()) ;
evaluated: b
TRUEFALSE
yes
Evaluation Count:2007
yes
Evaluation Count:2027
evaluated: !d->forceDisabled
TRUEFALSE
yes
Evaluation Count:1722
yes
Evaluation Count:285
evaluated: !d->group
TRUEFALSE
yes
Evaluation Count:1719
yes
Evaluation Count:3
partially evaluated: d->group->isEnabled()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-2027
598 -
599 d->setShortcutEnabled(d->enabled, (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap); -
600 -
601 d->sendDataChanged(); -
602}
executed: }
Execution Count:4034
4034
603 -
604 -
605bool QAction::isVisible() const -
606{ -
607 const QActionPrivate * const d = d_func(); -
608 return d->visible;
executed: return d->visible;
Execution Count:4614
4614
609} -
610 -
611 -
612 -
613 -
614bool -
615QAction::event(QEvent *e) -
616{ -
617 -
618 if (e->type() == QEvent::Shortcut) {
evaluated: e->type() == QEvent::Shortcut
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:9939
13-9939
619 QShortcutEvent *se = static_cast<QShortcutEvent *>(e); -
620 qt_noop(); -
621 -
622 -
623 if (se->isAmbiguous())
partially evaluated: se->isAmbiguous()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
624 QMessageLogger("kernel/qaction.cpp", 1101, __PRETTY_FUNCTION__).warning("QAction::eventFilter: Ambiguous shortcut overload: %s", se->key().toString(QKeySequence::NativeText).toLatin1().constData());
never executed: QMessageLogger("kernel/qaction.cpp", 1101, __PRETTY_FUNCTION__).warning("QAction::eventFilter: Ambiguous shortcut overload: %s", se->key().toString(QKeySequence::NativeText).toLatin1().constData());
0
625 else -
626 activate(Trigger);
executed: activate(Trigger);
Execution Count:13
13
627 return true;
executed: return true;
Execution Count:13
13
628 } -
629 -
630 return QObject::event(e);
executed: return QObject::event(e);
Execution Count:9939
9939
631} -
632 -
633 -
634 -
635 -
636 -
637 -
638QVariant -
639QAction::data() const -
640{ -
641 const QActionPrivate * const d = d_func(); -
642 return d->userData;
never executed: return d->userData;
0
643} -
644void -
645QAction::setData(const QVariant &data) -
646{ -
647 QActionPrivate * const d = d_func(); -
648 d->userData = data; -
649 d->sendDataChanged(); -
650}
executed: }
Execution Count:324
324
651bool -
652QAction::showStatusText(QWidget *widget) -
653{ -
654 return d_func()->showStatusText(widget, statusTip());
executed: return d_func()->showStatusText(widget, statusTip());
Execution Count:93
93
655} -
656 -
657 -
658 -
659 -
660 -
661 -
662 -
663void QAction::activate(ActionEvent event) -
664{ -
665 QActionPrivate * const d = d_func(); -
666 if(event == Trigger) {
evaluated: event == Trigger
TRUEFALSE
yes
Evaluation Count:74
yes
Evaluation Count:93
74-93
667 QPointer<QObject> guard = this; -
668 if(d->checkable) {
evaluated: d->checkable
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:62
12-62
669 -
670 if (d->checked && (d->group && d->group->isExclusive()
evaluated: d->checked
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:5
evaluated: d->group
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
partially evaluated: d->group->isExclusive()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-7
671 && d->group->checkedAction() == this)) {
partially evaluated: d->group->checkedAction() == this
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
672 if (!guard.isNull())
partially evaluated: !guard.isNull()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
673 triggered(true);
executed: triggered(true);
Execution Count:1
1
674 return;
executed: return;
Execution Count:1
1
675 } -
676 setChecked(!d->checked); -
677 }
executed: }
Execution Count:11
11
678 if (!guard.isNull())
partially evaluated: !guard.isNull()
TRUEFALSE
yes
Evaluation Count:73
no
Evaluation Count:0
0-73
679 triggered(d->checked);
executed: triggered(d->checked);
Execution Count:73
73
680 } else if(event == Hover) {
executed: }
Execution Count:73
partially evaluated: event == Hover
TRUEFALSE
yes
Evaluation Count:93
no
Evaluation Count:0
0-93
681 hovered(); -
682 }
executed: }
Execution Count:93
93
683} -
684void QAction::setMenuRole(MenuRole menuRole) -
685{ -
686 QActionPrivate * const d = d_func(); -
687 if (d->menuRole == menuRole)
never evaluated: d->menuRole == menuRole
0
688 return;
never executed: return;
0
689 -
690 d->menuRole = menuRole; -
691 d->sendDataChanged(); -
692}
never executed: }
0
693 -
694QAction::MenuRole QAction::menuRole() const -
695{ -
696 const QActionPrivate * const d = d_func(); -
697 return d->menuRole;
never executed: return d->menuRole;
0
698} -
699void QAction::setIconVisibleInMenu(bool visible) -
700{ -
701 QActionPrivate * const d = d_func(); -
702 if (d->iconVisibleInMenu == -1 || visible != bool(d->iconVisibleInMenu)) {
never evaluated: d->iconVisibleInMenu == -1
never evaluated: visible != bool(d->iconVisibleInMenu)
0
703 int oldValue = d->iconVisibleInMenu; -
704 d->iconVisibleInMenu = visible; -
705 -
706 if (oldValue != -1
never evaluated: oldValue != -1
0
707 || (oldValue == -1
never evaluated: oldValue == -1
0
708 && visible == !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus))) {
never evaluated: visible == !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus)
0
709 d->sendDataChanged(); -
710 }
never executed: }
0
711 }
never executed: }
0
712}
never executed: }
0
713 -
714bool QAction::isIconVisibleInMenu() const -
715{ -
716 const QActionPrivate * const d = d_func(); -
717 if (d->iconVisibleInMenu == -1) {
partially evaluated: d->iconVisibleInMenu == -1
TRUEFALSE
yes
Evaluation Count:2008
no
Evaluation Count:0
0-2008
718 return !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus);
executed: return !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus);
Execution Count:2008
2008
719 } -
720 return d->iconVisibleInMenu;
never executed: return d->iconVisibleInMenu;
0
721} -
722 -
723 -
724 -
725 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial