OpenCoverage

qshortcut.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qshortcut.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window);-
6-
7static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window);-
8-
9-
10static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidget *active_window);-
11-
12-
13-
14-
15-
16-
17-
18bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)-
19{-
20 ((!(object)) ? qt_assert_x("QShortcutMap", "Shortcut has no owner. Illegal map state!",__FILE__,79) : qt_noop());-
21-
22 QWidget *active_window = QApplication::activeWindow();-
23-
24-
25-
26-
27 if (QApplication::activePopupWidget()
QApplication::...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
28 active_window = QApplication::activePopupWidget();
never executed: active_window = QApplication::activePopupWidget();
0
29-
30 if (!active_window
!active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
31 QWindow *qwindow = QGuiApplication::focusWindow();-
32 if (qwindow
qwindowDescription
TRUEnever evaluated
FALSEnever evaluated
&& qwindow->isActive()
qwindow->isActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
33 while (qwindow
qwindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
34 QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(qwindow);-
35 if (widgetWindow
widgetWindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
36 active_window = widgetWindow->widget();-
37 break;
never executed: break;
0
38 }-
39 qwindow = qwindow->parent();-
40 }
never executed: end of block
0
41 }
never executed: end of block
0
42 }
never executed: end of block
0
43-
44 if (!active_window
!active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
45 return
never executed: return false;
false;
never executed: return false;
0
46-
47-
48 if (QAction *a = qobject_cast<QAction *>(object)
QAction *a = q...ion *>(object)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
49 return
never executed: return correctActionContext(context, a, active_window);
correctActionContext(context, a, active_window);
never executed: return correctActionContext(context, a, active_window);
0
50-
51-
52-
53 if (QGraphicsWidget *gw = qobject_cast<QGraphicsWidget *>(object)
QGraphicsWidge...get *>(object)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
54 return
never executed: return correctGraphicsWidgetContext(context, gw, active_window);
correctGraphicsWidgetContext(context, gw, active_window);
never executed: return correctGraphicsWidgetContext(context, gw, active_window);
0
55-
56-
57 QWidget *w = qobject_cast<QWidget *>(object);-
58 if (!w
!wDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
59 QShortcut *s = qobject_cast<QShortcut *>(object);-
60 if (s
sDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
61 w = s->parentWidget();
never executed: w = s->parentWidget();
0
62 }
never executed: end of block
0
63-
64 if (!w
!wDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
65 QWindow *qwindow = qobject_cast<QWindow *>(object);-
66 while (qwindow
qwindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
67 QWidgetWindow *widget_window = qobject_cast<QWidgetWindow *>(qwindow);-
68 if (widget_window
widget_windowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
69 w = widget_window->widget();-
70 break;
never executed: break;
0
71 }-
72 qwindow = qwindow->parent();-
73 }
never executed: end of block
0
74 }
never executed: end of block
0
75-
76 if (!w
!wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
77 return
never executed: return false;
false;
never executed: return false;
0
78-
79 return
never executed: return correctWidgetContext(context, w, active_window);
correctWidgetContext(context, w, active_window);
never executed: return correctWidgetContext(context, w, active_window);
0
80}-
81-
82static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window)-
83{-
84 bool visible = w->isVisible();-
85-
86-
87-
88-
89-
90 if (!visible
!visibleDescription
TRUEnever evaluated
FALSEnever evaluated
|| !w->isEnabled()
!w->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
91 return
never executed: return false;
false;
never executed: return false;
0
92-
93 if (context == Qt::ApplicationShortcut
context == Qt:...cationShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
94 return
never executed: return QApplicationPrivate::tryModalHelper(w, 0);
QApplicationPrivate::tryModalHelper(w, 0);
never executed: return QApplicationPrivate::tryModalHelper(w, 0);
0
95-
96 if (context == Qt::WidgetShortcut
context == Qt::WidgetShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
97 return
never executed: return w == QApplication::focusWidget();
w == QApplication::focusWidget();
never executed: return w == QApplication::focusWidget();
0
98-
99 if (context == Qt::WidgetWithChildrenShortcut
context == Qt:...ildrenShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
100 const QWidget *tw = QApplication::focusWidget();-
101 while (tw
twDescription
TRUEnever evaluated
FALSEnever evaluated
&& tw != w
tw != wDescription
TRUEnever evaluated
FALSEnever evaluated
&& (tw->windowType() == Qt::Widget
tw->windowType() == Qt::WidgetDescription
TRUEnever evaluated
FALSEnever evaluated
|| tw->windowType() == Qt::Popup
tw->windowType() == Qt::PopupDescription
TRUEnever evaluated
FALSEnever evaluated
|| tw->windowType() == Qt::SubWindow
tw->windowType... Qt::SubWindowDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
102 tw = tw->parentWidget();
never executed: tw = tw->parentWidget();
0
103 return
never executed: return tw == w;
tw == w;
never executed: return tw == w;
0
104 }-
105-
106-
107 QWidget *tlw = w->window();-
108-
109 if (QWExtra *topData = static_cast<QWidgetPrivate *>(QObjectPrivate::get(tlw))->extra
QWExtra *topDa...t(tlw))->extraDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
110 if (topData->proxyWidget
topData->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
111 bool res = correctGraphicsWidgetContext(context, (QGraphicsWidget *)topData->proxyWidget, active_window);-
112 return
never executed: return res;
res;
never executed: return res;
0
113 }-
114 }
never executed: end of block
0
115-
116-
117-
118-
119 if (active_window != tlw
active_window != tlwDescription
TRUEnever evaluated
FALSEnever evaluated
&& active_window
active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
&& active_window->windowType() == Qt::Tool
active_window-...() == Qt::ToolDescription
TRUEnever evaluated
FALSEnever evaluated
&& active_window->parentWidget()
active_window->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
120 active_window = active_window->parentWidget()->window();-
121 }
never executed: end of block
0
122-
123 if (active_window != tlw
active_window != tlwDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
124 return
never executed: return false;
false;
never executed: return false;
0
125-
126-
127-
128 const QWidget* sw = w;-
129 while (sw
swDescription
TRUEnever evaluated
FALSEnever evaluated
&& !(sw->windowType() == Qt::SubWindow)
!(sw->windowTy...Qt::SubWindow)Description
TRUEnever evaluated
FALSEnever evaluated
&& !sw->isWindow()
!sw->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
130 sw = sw->parentWidget();
never executed: sw = sw->parentWidget();
0
131 if (sw
swDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(sw->windowTyp...Qt::SubWindow)Description
TRUEnever evaluated
FALSEnever evaluated
sw->windowType() == Qt::SubWindow)
(sw->windowTyp...Qt::SubWindow)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
132 QWidget *focus_widget = QApplication::focusWidget();-
133 while (focus_widget
focus_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& focus_widget != sw
focus_widget != swDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
134 focus_widget = focus_widget->parentWidget();
never executed: focus_widget = focus_widget->parentWidget();
0
135 return
never executed: return sw == focus_widget;
sw == focus_widget;
never executed: return sw == focus_widget;
0
136 }-
137-
138-
139-
140-
141 return
never executed: return true;
true;
never executed: return true;
0
142}-
143-
144-
145static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window)-
146{-
147 bool visible = w->isVisible();-
148-
149-
150-
151-
152-
153 if (!visible
!visibleDescription
TRUEnever evaluated
FALSEnever evaluated
|| !w->isEnabled()
!w->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
|| !w->scene()
!w->scene()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
154 return
never executed: return false;
false;
never executed: return false;
0
155-
156 if (context == Qt::ApplicationShortcut
context == Qt:...cationShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
157-
158-
159-
160 QList<QGraphicsView *> views = w->scene()->views();-
161 for (int i = 0; i < views.size()
i < views.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
162 if (QApplicationPrivate::tryModalHelper(views.at(i), 0)
QApplicationPr...iews.at(i), 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
163 return
never executed: return true;
true;
never executed: return true;
0
164 }
never executed: end of block
0
165 return
never executed: return false;
false;
never executed: return false;
0
166 }-
167-
168 if (context == Qt::WidgetShortcut
context == Qt::WidgetShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
169 return
never executed: return static_cast<QGraphicsItem *>(w) == w->scene()->focusItem();
static_cast<QGraphicsItem *>(w) == w->scene()->focusItem();
never executed: return static_cast<QGraphicsItem *>(w) == w->scene()->focusItem();
0
170-
171 if (context == Qt::WidgetWithChildrenShortcut
context == Qt:...ildrenShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
172 const QGraphicsItem *ti = w->scene()->focusItem();-
173 if (ti
tiDescription
TRUEnever evaluated
FALSEnever evaluated
&& ti->isWidget()
ti->isWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
174 const QGraphicsWidget *tw = static_cast<const QGraphicsWidget *>(ti);-
175 while (tw
twDescription
TRUEnever evaluated
FALSEnever evaluated
&& tw != w
tw != wDescription
TRUEnever evaluated
FALSEnever evaluated
&& (tw->windowType() == Qt::Widget
tw->windowType() == Qt::WidgetDescription
TRUEnever evaluated
FALSEnever evaluated
|| tw->windowType() == Qt::Popup
tw->windowType() == Qt::PopupDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
176 tw = tw->parentWidget();
never executed: tw = tw->parentWidget();
0
177 return
never executed: return tw == w;
tw == w;
never executed: return tw == w;
0
178 }-
179 return
never executed: return false;
false;
never executed: return false;
0
180 }-
181-
182-
183-
184-
185 QList<QGraphicsView *> views = w->scene()->views();-
186 QGraphicsView *activeView = 0;-
187 for (int i = 0; i < views.size()
i < views.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
188 QGraphicsView *view = views.at(i);-
189 if (view->window() == active_window
view->window()... active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
190 activeView = view;-
191 break;
never executed: break;
0
192 }-
193 }
never executed: end of block
0
194 if (!activeView
!activeViewDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
195 return
never executed: return false;
false;
never executed: return false;
0
196-
197-
198-
199 QGraphicsWidget *a = w->scene()->activeWindow();-
200 return
never executed: return !w->window() || a == w->window();
!w->window() || a == w->window();
never executed: return !w->window() || a == w->window();
0
201}-
202-
203-
204-
205static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidget *active_window)-
206{-
207 const QList<QWidget *> &widgets = static_cast<QActionPrivate *>(QObjectPrivate::get(a))->widgets;-
208-
209-
210-
211-
212 for (int i = 0; i < widgets.size()
i < widgets.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
213 QWidget *w = widgets.at(i);-
214-
215 if (QMenu *menu = qobject_cast<QMenu *>(w)
QMenu *menu = ...st<QMenu *>(w)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
216 QAction *a = menu->menuAction();-
217 if (correctActionContext(context, a, active_window)
correctActionC...active_window)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
218 return
never executed: return true;
true;
never executed: return true;
0
219 }
never executed: end of block
else
0
220-
221 if (correctWidgetContext(context, w, active_window)
correctWidgetC...active_window)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
222 return
never executed: return true;
true;
never executed: return true;
0
223 }
never executed: end of block
0
224-
225-
226 const QList<QGraphicsWidget *> &graphicsWidgets = static_cast<QActionPrivate *>(QObjectPrivate::get(a))->graphicsWidgets;-
227-
228-
229-
230-
231 for (int i = 0; i < graphicsWidgets.size()
i < graphicsWidgets.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
232 QGraphicsWidget *w = graphicsWidgets.at(i);-
233 if (correctGraphicsWidgetContext(context, w, active_window)
correctGraphic...active_window)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
234 return
never executed: return true;
true;
never executed: return true;
0
235 }
never executed: end of block
0
236-
237 return
never executed: return false;
false;
never executed: return false;
0
238}-
239class QShortcutPrivate : public QObjectPrivate-
240{-
241 inline QShortcut* q_func() { return static_cast<QShortcut *>(q_ptr); } inline const QShortcut* q_func() const { return static_cast<const QShortcut *>(q_ptr); } friend class QShortcut;-
242public:-
243 QShortcutPrivate() : sc_context(Qt::WindowShortcut), sc_enabled(true), sc_autorepeat(true), sc_id(0) {}
never executed: end of block
0
244 QKeySequence sc_sequence;-
245 Qt::ShortcutContext sc_context;-
246 bool sc_enabled;-
247 bool sc_autorepeat;-
248 int sc_id;-
249 QString sc_whatsthis;-
250 void redoGrab(QShortcutMap &map);-
251};-
252-
253void QShortcutPrivate::redoGrab(QShortcutMap &map)-
254{-
255 QShortcut * const q = q_func();-
256 if (__builtin_expect(!!(!parent), false)
__builtin_expe...arent), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
257 QMessageLogger(__FILE__, 420, __PRETTY_FUNCTION__).warning("QShortcut: No widget parent defined");-
258 return;
never executed: return;
0
259 }-
260-
261 if (sc_id
sc_idDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
262 map.removeShortcut(sc_id, q);
never executed: map.removeShortcut(sc_id, q);
0
263 if (sc_sequence.isEmpty()
sc_sequence.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
264 return;
never executed: return;
0
265 sc_id = map.addShortcut(q, sc_sequence, sc_context, qWidgetShortcutContextMatcher);-
266 if (!sc_enabled
!sc_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
267 map.setShortcutEnabled(false, sc_id, q);
never executed: map.setShortcutEnabled(false, sc_id, q);
0
268 if (!sc_autorepeat
!sc_autorepeatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
269 map.setShortcutAutoRepeat(false, sc_id, q);
never executed: map.setShortcutAutoRepeat(false, sc_id, q);
0
270}
never executed: end of block
0
271QShortcut::QShortcut(QWidget *parent)-
272 : QObject(*new QShortcutPrivate, parent)-
273{-
274 ((!(parent != 0)) ? qt_assert("parent != 0",__FILE__,445) : qt_noop());-
275}
never executed: end of block
0
276QShortcut::QShortcut(const QKeySequence &key, QWidget *parent,-
277 const char *member, const char *ambiguousMember,-
278 Qt::ShortcutContext context)-
279 : QObject(*new QShortcutPrivate, parent)-
280{-
281 if (__builtin_expect(!!(!(static_cast<QApplication *>(QCoreApplication::instance()))), false)
__builtin_expe...e()))), false)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 461, __PRETTY_FUNCTION__).warning("QShortcut: Initialize QApplication before calling '" "QShortcut" "'."); return;
never executed: return;
};
0
282-
283 QShortcutPrivate * const d = d_func();-
284 ((!(parent != 0)) ? qt_assert("parent != 0",__FILE__,464) : qt_noop());-
285 d->sc_context = context;-
286 d->sc_sequence = key;-
287 d->redoGrab((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap);-
288 if (member
memberDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
289 connect(this, qFlagLocation("2""activated()" "\0" __FILE__ ":" "469"), parent, member);
never executed: connect(this, qFlagLocation("2""activated()" "\0" __FILE__ ":" "469"), parent, member);
0
290 if (ambiguousMember
ambiguousMemberDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
291 connect(this, qFlagLocation("2""activatedAmbiguously()" "\0" __FILE__ ":" "471"), parent, ambiguousMember);
never executed: connect(this, qFlagLocation("2""activatedAmbiguously()" "\0" __FILE__ ":" "471"), parent, ambiguousMember);
0
292}
never executed: end of block
0
293-
294-
295-
296-
297QShortcut::~QShortcut()-
298{-
299 QShortcutPrivate * const d = d_func();-
300 if ((static_cast<
(static_cast<Q...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
QApplication *>(QCoreApplication::instance()))
(static_cast<Q...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
301 (static_cast<
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(d->sc_id, this);
QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(d->sc_id, this);
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(d->sc_id, this);
0
302}
never executed: end of block
0
303void QShortcut::setKey(const QKeySequence &key)-
304{-
305 QShortcutPrivate * const d = d_func();-
306 if (d->sc_sequence == key
d->sc_sequence == keyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
307 return;
never executed: return;
0
308 if (__builtin_expect(!!(!(static_cast<QApplication *>(QCoreApplication::instance()))), false)
__builtin_expe...e()))), false)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 500, __PRETTY_FUNCTION__).warning("QShortcut: Initialize QApplication before calling '" "setKey" "'."); return;
never executed: return;
};
0
309 d->sc_sequence = key;-
310 d->redoGrab((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap);-
311}
never executed: end of block
0
312-
313QKeySequence QShortcut::key() const-
314{-
315 const QShortcutPrivate * const d = d_func();-
316 return
never executed: return d->sc_sequence;
d->sc_sequence;
never executed: return d->sc_sequence;
0
317}-
318void QShortcut::setEnabled(bool enable)-
319{-
320 QShortcutPrivate * const d = d_func();-
321 if (d->sc_enabled == enable
d->sc_enabled == enableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
322 return;
never executed: return;
0
323 if (__builtin_expect(!!(!(static_cast<QApplication *>(QCoreApplication::instance()))), false)
__builtin_expe...e()))), false)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 531, __PRETTY_FUNCTION__).warning("QShortcut: Initialize QApplication before calling '" "setEnabled" "'."); return;
never executed: return;
};
0
324 d->sc_enabled = enable;-
325 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutEnabled(enable, d->sc_id, this);-
326}
never executed: end of block
0
327-
328bool QShortcut::isEnabled() const-
329{-
330 const QShortcutPrivate * const d = d_func();-
331 return
never executed: return d->sc_enabled;
d->sc_enabled;
never executed: return d->sc_enabled;
0
332}-
333void QShortcut::setContext(Qt::ShortcutContext context)-
334{-
335 QShortcutPrivate * const d = d_func();-
336 if(d->sc_context == context
d->sc_context == contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
337 return;
never executed: return;
0
338 if (__builtin_expect(!!(!(static_cast<QApplication *>(QCoreApplication::instance()))), false)
__builtin_expe...e()))), false)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 559, __PRETTY_FUNCTION__).warning("QShortcut: Initialize QApplication before calling '" "setContext" "'."); return;
never executed: return;
};
0
339 d->sc_context = context;-
340 d->redoGrab((static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap);-
341}
never executed: end of block
0
342-
343Qt::ShortcutContext QShortcut::context() const-
344{-
345 const QShortcutPrivate * const d = d_func();-
346 return
never executed: return d->sc_context;
d->sc_context;
never executed: return d->sc_context;
0
347}-
348void QShortcut::setWhatsThis(const QString &text)-
349{-
350 QShortcutPrivate * const d = d_func();-
351 d->sc_whatsthis = text;-
352}
never executed: end of block
0
353-
354QString QShortcut::whatsThis() const-
355{-
356 const QShortcutPrivate * const d = d_func();-
357 return
never executed: return d->sc_whatsthis;
d->sc_whatsthis;
never executed: return d->sc_whatsthis;
0
358}-
359void QShortcut::setAutoRepeat(bool on)-
360{-
361 QShortcutPrivate * const d = d_func();-
362 if (d->sc_autorepeat == on
d->sc_autorepeat == onDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
363 return;
never executed: return;
0
364 if (__builtin_expect(!!(!(static_cast<QApplication *>(QCoreApplication::instance()))), false)
__builtin_expe...e()))), false)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 611, __PRETTY_FUNCTION__).warning("QShortcut: Initialize QApplication before calling '" "setAutoRepeat" "'."); return;
never executed: return;
};
0
365 d->sc_autorepeat = on;-
366 (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutAutoRepeat(on, d->sc_id, this);-
367}
never executed: end of block
0
368-
369bool QShortcut::autoRepeat() const-
370{-
371 const QShortcutPrivate * const d = d_func();-
372 return
never executed: return d->sc_autorepeat;
d->sc_autorepeat;
never executed: return d->sc_autorepeat;
0
373}-
374-
375-
376-
377-
378-
379-
380int QShortcut::id() const-
381{-
382 const QShortcutPrivate * const d = d_func();-
383 return
never executed: return d->sc_id;
d->sc_id;
never executed: return d->sc_id;
0
384}-
385-
386-
387-
388-
389bool QShortcut::event(QEvent *e)-
390{-
391 QShortcutPrivate * const d = d_func();-
392 bool handled = false;-
393 if (d->sc_enabled
d->sc_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
&& e->type() == QEvent::Shortcut
e->type() == QEvent::ShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
394 QShortcutEvent *se = static_cast<QShortcutEvent *>(e);-
395 if (se->shortcutId() == d->sc_id
se->shortcutId() == d->sc_idDescription
TRUEnever evaluated
FALSEnever evaluated
&& se->key() == d->sc_sequence
se->key() == d->sc_sequenceDescription
TRUEnever evaluated
FALSEnever evaluated
){
0
396-
397 if (QWhatsThis::inWhatsThisMode()
QWhatsThis::inWhatsThisMode()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
398 QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis);-
399 handled = true;-
400 }
never executed: end of block
else
0
401-
402 if (se->isAmbiguous()
se->isAmbiguous()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
403 activatedAmbiguously();
never executed: activatedAmbiguously();
0
404 else-
405 activated();
never executed: activated();
0
406 handled = true;-
407 }
never executed: end of block
0
408 }
never executed: end of block
0
409 return
never executed: return handled;
handled;
never executed: return handled;
0
410}-
411-
412-
413-
414-
Switch to Source codePreprocessed file

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