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 (!(static_cast<QApplication *>(QCoreApplication::instance()))
!(static_cast<...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 390, __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 (!(static_cast<QApplication *>(QCoreApplication::instance()))
!(static_cast<...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 422, __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 (!(static_cast<QApplication *>(QCoreApplication::instance()))
!(static_cast<...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 489, __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 (!(static_cast<QApplication *>(QCoreApplication::instance()))
!(static_cast<...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 517, __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}
never executed: end of block
0
351-
352-
353-
354-
355-
356-
357-
358QActionGroup *QAction::actionGroup() const-
359{-
360 const QActionPrivate * const d = d_func();-
361 return
never executed: return d->group;
d->group;
never executed: return d->group;
0
362}-
363void QAction::setIcon(const QIcon &icon)-
364{-
365 QActionPrivate * const d = d_func();-
366 d->icon = icon;-
367 d->sendDataChanged();-
368}
never executed: end of block
0
369-
370QIcon QAction::icon() const-
371{-
372 const QActionPrivate * const d = d_func();-
373 return
never executed: return d->icon;
d->icon;
never executed: return d->icon;
0
374}-
375QMenu *QAction::menu() const-
376{-
377 const QActionPrivate * const d = d_func();-
378 return
never executed: return d->menu;
d->menu;
never executed: return d->menu;
0
379}-
380-
381-
382-
383-
384void QAction::setMenu(QMenu *menu)-
385{-
386 QActionPrivate * const d = d_func();-
387 if (d->menu
d->menuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
388 d->menu->d_func()->setOverrideMenuAction(0);
never executed: d->menu->d_func()->setOverrideMenuAction(0);
0
389 d->menu = menu;-
390 if (menu
menuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
391 menu->d_func()->setOverrideMenuAction(this);
never executed: menu->d_func()->setOverrideMenuAction(this);
0
392 d->sendDataChanged();-
393}
never executed: end of block
0
394void QAction::setSeparator(bool b)-
395{-
396 QActionPrivate * const d = d_func();-
397 if (d->separator == b
d->separator == bDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
398 return;
never executed: return;
0
399-
400 d->separator = b;-
401 d->sendDataChanged();-
402}
never executed: end of block
0
403-
404-
405-
406-
407-
408-
409-
410bool QAction::isSeparator() const-
411{-
412 const QActionPrivate * const d = d_func();-
413 return
never executed: return d->separator;
d->separator;
never executed: return d->separator;
0
414}-
415void QAction::setText(const QString &text)-
416{-
417 QActionPrivate * const d = d_func();-
418 if (d->text == text
d->text == textDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
419 return;
never executed: return;
0
420-
421 d->text = text;-
422 d->sendDataChanged();-
423}
never executed: end of block
0
424-
425QString QAction::text() const-
426{-
427 const QActionPrivate * const d = d_func();-
428 QString s = d->text;-
429 if(s.isEmpty()
s.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
430 s = d->iconText;-
431 s.replace(QLatin1Char('&'), QLatin1String("&&"));-
432 }
never executed: end of block
0
433 return
never executed: return s;
s;
never executed: return s;
0
434}-
435void QAction::setIconText(const QString &text)-
436{-
437 QActionPrivate * const d = d_func();-
438 if (d->iconText == text
d->iconText == textDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
439 return;
never executed: return;
0
440-
441 d->iconText = text;-
442 d->sendDataChanged();-
443}
never executed: end of block
0
444-
445QString QAction::iconText() const-
446{-
447 const QActionPrivate * const d = d_func();-
448 if (d->iconText.isEmpty()
d->iconText.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
449 return
never executed: return qt_strippedText(d->text);
qt_strippedText(d->text);
never executed: return qt_strippedText(d->text);
0
450 return
never executed: return d->iconText;
d->iconText;
never executed: return d->iconText;
0
451}-
452void QAction::setToolTip(const QString &tooltip)-
453{-
454 QActionPrivate * const d = d_func();-
455 if (d->tooltip == tooltip
d->tooltip == tooltipDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
456 return;
never executed: return;
0
457-
458 d->tooltip = tooltip;-
459 d->sendDataChanged();-
460}
never executed: end of block
0
461-
462QString QAction::toolTip() const-
463{-
464 const QActionPrivate * const d = d_func();-
465 if (d->tooltip.isEmpty()
d->tooltip.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
466 if (!d->text.isEmpty()
!d->text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
467 return
never executed: return qt_strippedText(d->text);
qt_strippedText(d->text);
never executed: return qt_strippedText(d->text);
0
468 return
never executed: return qt_strippedText(d->iconText);
qt_strippedText(d->iconText);
never executed: return qt_strippedText(d->iconText);
0
469 }-
470 return
never executed: return d->tooltip;
d->tooltip;
never executed: return d->tooltip;
0
471}-
472void QAction::setStatusTip(const QString &statustip)-
473{-
474 QActionPrivate * const d = d_func();-
475 if (d->statustip == statustip
d->statustip == statustipDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
476 return;
never executed: return;
0
477-
478 d->statustip = statustip;-
479 d->sendDataChanged();-
480}
never executed: end of block
0
481-
482QString QAction::statusTip() const-
483{-
484 const QActionPrivate * const d = d_func();-
485 return
never executed: return d->statustip;
d->statustip;
never executed: return d->statustip;
0
486}-
487void QAction::setWhatsThis(const QString &whatsthis)-
488{-
489 QActionPrivate * const d = d_func();-
490 if (d->whatsthis == whatsthis
d->whatsthis == whatsthisDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
491 return;
never executed: return;
0
492-
493 d->whatsthis = whatsthis;-
494 d->sendDataChanged();-
495}
never executed: end of block
0
496-
497QString QAction::whatsThis() const-
498{-
499 const QActionPrivate * const d = d_func();-
500 return
never executed: return d->whatsthis;
d->whatsthis;
never executed: return d->whatsthis;
0
501}-
502void QAction::setPriority(Priority priority)-
503{-
504 QActionPrivate * const d = d_func();-
505 if (d->priority == priority
d->priority == priorityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
506 return;
never executed: return;
0
507-
508 d->priority = priority;-
509 d->sendDataChanged();-
510}
never executed: end of block
0
511-
512QAction::Priority QAction::priority() const-
513{-
514 const QActionPrivate * const d = d_func();-
515 return
never executed: return d->priority;
d->priority;
never executed: return d->priority;
0
516}-
517void QAction::setCheckable(bool b)-
518{-
519 QActionPrivate * const d = d_func();-
520 if (d->checkable == b
d->checkable == bDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
521 return;
never executed: return;
0
522-
523 d->checkable = b;-
524 d->checked = false;-
525 d->sendDataChanged();-
526}
never executed: end of block
0
527-
528bool QAction::isCheckable() const-
529{-
530 const QActionPrivate * const d = d_func();-
531 return
never executed: return d->checkable;
d->checkable;
never executed: return d->checkable;
0
532}-
533-
534-
535-
536-
537-
538-
539-
540void QAction::toggle()-
541{-
542 QActionPrivate * const d = d_func();-
543 setChecked(!d->checked);-
544}
never executed: end of block
0
545void QAction::setChecked(bool b)-
546{-
547 QActionPrivate * const d = d_func();-
548 if (!d->checkable
!d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->checked == b
d->checked == bDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
549 return;
never executed: return;
0
550-
551 QPointer<QAction> guard(this);-
552 d->checked = b;-
553 d->sendDataChanged();-
554 if (guard
guardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
555 toggled(b);
never executed: toggled(b);
0
556}
never executed: end of block
0
557-
558bool QAction::isChecked() const-
559{-
560 const QActionPrivate * const d = d_func();-
561 return
never executed: return d->checked;
d->checked;
never executed: return d->checked;
0
562}-
563void QAction::setEnabled(bool b)-
564{-
565 QActionPrivate * const d = d_func();-
566 if (b == d->enabled
b == d->enabledDescription
TRUEnever evaluated
FALSEnever evaluated
&& b != d->forceDisabled
b != d->forceDisabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
567 return;
never executed: return;
0
568 d->forceDisabled = !b;-
569 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
570 return;
never executed: return;
0
571 if (!(static_cast<QApplication *>(QCoreApplication::instance()))
!(static_cast<...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1027, __PRETTY_FUNCTION__).warning("QAction: Initialize QApplication before calling '" "setEnabled" "'."); return;
never executed: return;
};
0
572 d->enabled = b;-
573-
574 d->setShortcutEnabled(b, (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap);-
575-
576 d->sendDataChanged();-
577}
never executed: end of block
0
578-
579bool QAction::isEnabled() const-
580{-
581 const QActionPrivate * const d = d_func();-
582 return
never executed: return d->enabled;
d->enabled;
never executed: return d->enabled;
0
583}-
584void QAction::setVisible(bool b)-
585{-
586 QActionPrivate * const d = d_func();-
587 if (b == d->visible
b == d->visibleDescription
TRUEnever evaluated
FALSEnever evaluated
&& b != d->forceInvisible
b != d->forceInvisibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
588 return;
never executed: return;
0
589 if (!(static_cast<QApplication *>(QCoreApplication::instance()))
!(static_cast<...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1059, __PRETTY_FUNCTION__).warning("QAction: Initialize QApplication before calling '" "setVisible" "'."); return;
never executed: return;
};
0
590 d->forceInvisible = !b;-
591 d->visible = b;-
592 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
593-
594 d->setShortcutEnabled(d->enabled, (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap);-
595-
596 d->sendDataChanged();-
597}
never executed: end of block
0
598-
599-
600bool QAction::isVisible() const-
601{-
602 const QActionPrivate * const d = d_func();-
603 return
never executed: return d->visible;
d->visible;
never executed: return d->visible;
0
604}-
605-
606-
607-
608-
609bool-
610QAction::event(QEvent *e)-
611{-
612-
613 if (e->type() == QEvent::Shortcut
e->type() == QEvent::ShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
614 QShortcutEvent *se = static_cast<QShortcutEvent *>(e);-
615 ((!(se->key() == d_func()->shortcut || d_func()->alternateShortcuts.contains(se->key()))) ? qt_assert_x("QAction::event", "Received shortcut event from incorrect shortcut",-
616-
617 __FILE__-
618 ,-
619-
620 1087-
621 ) : qt_noop())-
622-
623 ;-
624 if (se->isAmbiguous()
se->isAmbiguous()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
625 QMessageLogger(__FILE__, 1089, __PRETTY_FUNCTION__).warning("QAction::eventFilter: Ambiguous shortcut overload: %s", se->key().toString(QKeySequence::NativeText).toLatin1().constData());
never executed: QMessageLogger(__FILE__, 1089, __PRETTY_FUNCTION__).warning("QAction::eventFilter: Ambiguous shortcut overload: %s", se->key().toString(QKeySequence::NativeText).toLatin1().constData());
0
626 else-
627 activate(Trigger);
never executed: activate(Trigger);
0
628 return
never executed: return true;
true;
never executed: return true;
0
629 }-
630-
631 return
never executed: return QObject::event(e);
QObject::event(e);
never executed: return QObject::event(e);
0
632}-
633-
634-
635-
636-
637-
638-
639QVariant-
640QAction::data() const-
641{-
642 const QActionPrivate * const d = d_func();-
643 return
never executed: return d->userData;
d->userData;
never executed: return d->userData;
0
644}-
645void-
646QAction::setData(const QVariant &data)-
647{-
648 QActionPrivate * const d = d_func();-
649 d->userData = data;-
650 d->sendDataChanged();-
651}
never executed: end of block
0
652bool-
653QAction::showStatusText(QWidget *widget)-
654{-
655 return
never executed: return d_func()->showStatusText(widget, statusTip());
d_func()->showStatusText(widget, statusTip());
never executed: return d_func()->showStatusText(widget, statusTip());
0
656}-
657-
658-
659-
660-
661-
662-
663-
664void QAction::activate(ActionEvent event)-
665{-
666 QActionPrivate * const d = d_func();-
667 if(event == Trigger
event == TriggerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
668 QPointer<QObject> guard = this;-
669 if(d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
670-
671 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
672 && d->group->checkedAction() == this
d->group->chec...tion() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
673 if (!guard.isNull()
!guard.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
674 triggered(true);
never executed: triggered(true);
0
675 return;
never executed: return;
0
676 }-
677 setChecked(!d->checked);-
678 }
never executed: end of block
0
679 if (!guard.isNull()
!guard.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
680 triggered(d->checked);
never executed: triggered(d->checked);
0
681 }
never executed: end of block
else if(event == Hover
event == HoverDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
682 hovered();-
683 }
never executed: end of block
0
684}
never executed: end of block
0
685void QAction::setMenuRole(MenuRole menuRole)-
686{-
687 QActionPrivate * const d = d_func();-
688 if (d->menuRole == menuRole
d->menuRole == menuRoleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
689 return;
never executed: return;
0
690-
691 d->menuRole = menuRole;-
692 d->sendDataChanged();-
693}
never executed: end of block
0
694-
695QAction::MenuRole QAction::menuRole() const-
696{-
697 const QActionPrivate * const d = d_func();-
698 return
never executed: return d->menuRole;
d->menuRole;
never executed: return d->menuRole;
0
699}-
700void QAction::setIconVisibleInMenu(bool visible)-
701{-
702 QActionPrivate * const d = d_func();-
703 if (d->iconVisibleInMenu == -1
d->iconVisibleInMenu == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| visible != bool(d->iconVisibleInMenu)
visible != boo...VisibleInMenu)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
704 int oldValue = d->iconVisibleInMenu;-
705 d->iconVisibleInMenu = visible;-
706-
707 if (oldValue != -1
oldValue != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
708 || (oldValue == -1
oldValue == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
709 && visible == !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus)
visible == !QA...wIconsInMenus)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
710 d->sendDataChanged();-
711 }
never executed: end of block
0
712 }
never executed: end of block
0
713}
never executed: end of block
0
714-
715bool QAction::isIconVisibleInMenu() const-
716{-
717 const QActionPrivate * const d = d_func();-
718 if (d->iconVisibleInMenu == -1
d->iconVisibleInMenu == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
719 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
720 }-
721 return
never executed: return d->iconVisibleInMenu;
d->iconVisibleInMenu;
never executed: return d->iconVisibleInMenu;
0
722}-
723-
724-
725__attribute__((visibility("default"))) QDebug operator<<(QDebug d, const QAction *action)-
726{-
727 QDebugStateSaver saver(d);-
728 d.nospace();-
729 d << "QAction(" << static_cast<const void *>(action);-
730 if (action
actionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
731 d << " text=" << action->text();-
732 if (!action->toolTip().isEmpty()
!action->toolTip().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
733 d << " toolTip=" << action->toolTip();
never executed: d << " toolTip=" << action->toolTip();
0
734 if (action->isCheckable()
action->isCheckable()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
735 d << " checked=" << action->isChecked();
never executed: d << " checked=" << action->isChecked();
0
736 if (!action->shortcut().isEmpty()
!action->shortcut().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
737 d << " shortcut=" << action->shortcut();
never executed: d << " shortcut=" << action->shortcut();
0
738 d << " menuRole=";-
739 QtDebugUtils::formatQEnum(d, action->menuRole());-
740 d << " visible=" << action->isVisible();-
741 }
never executed: end of block
else {
0
742 d << '0';-
743 }
never executed: end of block
0
744 d << ')';-
745 return
never executed: return d;
d;
never executed: return d;
0
746}-
747-
748-
749-
750-
Switch to Source codePreprocessed file

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