OpenCoverage

qaction.cpp

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

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