qmenu.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qmenu.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17QMenu *QMenuPrivate::mouseDown = 0;-
18-
19-
20-
21class QTornOffMenu : public QMenu-
22{-
23 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
24#pragma GCC diagnostic push-
25 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
26#pragma GCC diagnostic pop-
27 struct QPrivateSignal {};-
28 class QTornOffMenuPrivate : public QMenuPrivate-
29 {-
30 inline QMenu* q_func() { return static_cast<QMenu *>(q_ptr); } inline const QMenu* q_func() const { return static_cast<const QMenu *>(q_ptr); } friend class QMenu;-
31 public:-
32 QTornOffMenuPrivate(QMenu *p) : causedMenu(p) {-
33 tornoff = 1;-
34 causedPopup.widget = 0;-
35 causedPopup.action = ((QTornOffMenu*)p)->d_func()->causedPopup.action;-
36 causedStack = ((QTornOffMenu*)p)->d_func()->calcCausedStack();-
37 }
never executed: end of block
0
38 QVector<QPointer<QWidget> > calcCausedStack() const override { return
never executed: return causedStack;
causedStack;
never executed: return causedStack;
}
0
39 QPointer<QMenu> causedMenu;-
40 QVector<QPointer<QWidget> > causedStack;-
41 };-
42public:-
43 QTornOffMenu(QMenu *p) : QMenu(*(new QTornOffMenuPrivate(p)))-
44 {-
45 QTornOffMenuPrivate * const d = d_func();-
46-
47 QWidget *parentWidget = d->causedStack.isEmpty()
d->causedStack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
? p : d->causedStack.constLast();
0
48 if (parentWidget->parentWidget()
parentWidget->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
49 parentWidget = parentWidget->parentWidget();
never executed: parentWidget = parentWidget->parentWidget();
0
50 setParent(parentWidget, Qt::Window | Qt::Tool);-
51 setAttribute(Qt::WA_DeleteOnClose, true);-
52 setAttribute(Qt::WA_X11NetWmWindowTypeMenu, true);-
53 setWindowTitle(p->windowTitle());-
54 setEnabled(p->isEnabled());-
55-
56-
57 QList<QAction*> items = p->actions();-
58 for(int i = 0; i < items.count()
i < items.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
59 addAction(items.at(i));
never executed: addAction(items.at(i));
0
60 }
never executed: end of block
0
61 void syncWithMenu(QMenu *menu, QActionEvent *act)-
62 {-
63 QTornOffMenuPrivate * const d = d_func();-
64 if(menu != d->causedMenu
menu != d->causedMenuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
65 return;
never executed: return;
0
66 if (act->type() == QEvent::ActionAdded
act->type() ==...t::ActionAddedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
67 insertAction(act->before(), act->action());-
68 }
never executed: end of block
else if (act->type() == QEvent::ActionRemoved
act->type() ==...:ActionRemovedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
69 removeAction(act->action());
never executed: removeAction(act->action());
0
70 }
never executed: end of block
0
71 void actionEvent(QActionEvent *e) override-
72 {-
73 QMenu::actionEvent(e);-
74 setFixedSize(sizeHint());-
75 }
never executed: end of block
0
76public :-
77 void onTrigger(QAction *action) { d_func()->activateAction(action, QAction::Trigger, false); }
never executed: end of block
0
78 void onHovered(QAction *action) { d_func()->activateAction(action, QAction::Hover, false); }
never executed: end of block
0
79private:-
80 inline QTornOffMenuPrivate* d_func() { return
never executed: return reinterpret_cast<QTornOffMenuPrivate *>(qGetPtrHelper(d_ptr));
reinterpret_cast<QTornOffMenuPrivate *>(qGetPtrHelper(d_ptr));
never executed: return reinterpret_cast<QTornOffMenuPrivate *>(qGetPtrHelper(d_ptr));
} inline const QTornOffMenuPrivate* d_func() const { return
never executed: return reinterpret_cast<const QTornOffMenuPrivate *>(qGetPtrHelper(d_ptr));
reinterpret_cast<const QTornOffMenuPrivate *>(qGetPtrHelper(d_ptr));
never executed: return reinterpret_cast<const QTornOffMenuPrivate *>(qGetPtrHelper(d_ptr));
} friend class QTornOffMenuPrivate;
0
81 friend class QMenuPrivate;-
82};-
83-
84void QMenuPrivate::init()-
85{-
86 QMenu * const q = q_func();-
87-
88 q->setAttribute(Qt::WA_CustomWhatsThis);-
89-
90 q->setAttribute(Qt::WA_X11NetWmWindowTypePopupMenu);-
91 defaultMenuAction = menuAction = new QAction(q);-
92 menuAction->d_func()->menu = q;-
93 q->setMouseTracking(q->style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, q));-
94 if (q->style()->styleHint(QStyle::SH_Menu_Scrollable, 0, q)
q->style()->st...ollable, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
95 scroll = new QMenuPrivate::QMenuScroller;-
96 scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;-
97 }
never executed: end of block
0
98-
99 setPlatformMenu(QGuiApplicationPrivate::platformTheme()->createPlatformMenu());-
100 sloppyState.initialize(q);-
101 delayState.initialize(q);-
102 mousePopupDelay = q->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, q);-
103}
never executed: end of block
0
104-
105void QMenuPrivate::setPlatformMenu(QPlatformMenu *menu)-
106{-
107 QMenu * const q = q_func();-
108 if (!platformMenu.isNull()
!platformMenu.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
&& !platformMenu->parent()
!platformMenu->parent()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
109 delete platformMenu.data();
never executed: delete platformMenu.data();
0
110-
111 platformMenu = menu;-
112 if (!platformMenu.isNull()
!platformMenu.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
113 QObject::connect(platformMenu, qFlagLocation("2""aboutToShow()" "\0" __FILE__ ":" "170"), q, qFlagLocation("1""_q_platformMenuAboutToShow()" "\0" __FILE__ ":" "170"));-
114 QObject::connect(platformMenu, qFlagLocation("2""aboutToHide()" "\0" __FILE__ ":" "171"), q, qFlagLocation("2""aboutToHide()" "\0" __FILE__ ":" "171"));-
115 }
never executed: end of block
0
116}
never executed: end of block
0
117-
118-
119static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *item, QPlatformMenu *itemsMenu);-
120-
121void QMenuPrivate::syncPlatformMenu()-
122{-
123 QMenu * const q = q_func();-
124 if (platformMenu.isNull()
platformMenu.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
125 return;
never executed: return;
0
126-
127 QPlatformMenuItem *beforeItem = nullptr;-
128 const QList<QAction*> actions = q->actions();-
129 for (QList<QAction*>::const_reverse_iterator it = actions.rbegin(), end = actions.rend(); it != end
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
130 QPlatformMenuItem *menuItem = platformMenu->createMenuItem();-
131 QAction *action = *it;-
132 menuItem->setTag(reinterpret_cast<quintptr>(action));-
133 QObject::connect(menuItem, qFlagLocation("2""activated()" "\0" __FILE__ ":" "190"), action, qFlagLocation("1""trigger()" "\0" __FILE__ ":" "190"), Qt::QueuedConnection);-
134 QObject::connect(menuItem, qFlagLocation("2""hovered()" "\0" __FILE__ ":" "191"), action, qFlagLocation("2""hovered()" "\0" __FILE__ ":" "191"), Qt::QueuedConnection);-
135 copyActionToPlatformItem(action, menuItem, platformMenu.data());-
136 platformMenu->insertMenuItem(menuItem, beforeItem);-
137 beforeItem = menuItem;-
138 }
never executed: end of block
0
139 platformMenu->syncSeparatorsCollapsible(collapsibleSeparators);-
140 platformMenu->setEnabled(q->isEnabled());-
141}
never executed: end of block
0
142-
143int QMenuPrivate::scrollerHeight() const-
144{-
145 const QMenu * const q = q_func();-
146 return
never executed: return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q));
qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q));
never executed: return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q));
0
147}-
148-
149-
150QRect QMenuPrivate::popupGeometry(const QWidget *widget) const-
151{-
152 if (QGuiApplicationPrivate::platformTheme()
QGuiApplicatio...latformTheme()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
153 QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()
QGuiApplicatio...Menu).toBool()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
154 return
never executed: return QApplication::desktop()->screenGeometry(widget);
QApplication::desktop()->screenGeometry(widget);
never executed: return QApplication::desktop()->screenGeometry(widget);
0
155 } else {-
156 return
never executed: return QApplication::desktop()->availableGeometry(widget);
QApplication::desktop()->availableGeometry(widget);
never executed: return QApplication::desktop()->availableGeometry(widget);
0
157 }-
158}-
159-
160-
161QRect QMenuPrivate::popupGeometry(int screen) const-
162{-
163 if (QGuiApplicationPrivate::platformTheme()
QGuiApplicatio...latformTheme()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
164 QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()
QGuiApplicatio...Menu).toBool()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
165 return
never executed: return QApplication::desktop()->screenGeometry(screen);
QApplication::desktop()->screenGeometry(screen);
never executed: return QApplication::desktop()->screenGeometry(screen);
0
166 } else {-
167 return
never executed: return QApplication::desktop()->availableGeometry(screen);
QApplication::desktop()->availableGeometry(screen);
never executed: return QApplication::desktop()->availableGeometry(screen);
0
168 }-
169}-
170-
171QVector<QPointer<QWidget> > QMenuPrivate::calcCausedStack() const-
172{-
173 QVector<QPointer<QWidget> > ret;-
174 for(QWidget *widget = causedPopup.widget; widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
; ) {
0
175 ret.append(widget);-
176 if (QTornOffMenu *qtmenu = qobject_cast<QTornOffMenu*>(widget)
QTornOffMenu *...Menu*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
177 ret += qtmenu->d_func()->causedStack;
never executed: ret += qtmenu->d_func()->causedStack;
0
178 if (QMenu *qmenu = qobject_cast<QMenu*>(widget)
QMenu *qmenu =...Menu*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
179 widget = qmenu->d_func()->causedPopup.widget;
never executed: widget = qmenu->d_func()->causedPopup.widget;
0
180 else-
181 break;
never executed: break;
0
182 }-
183 return
never executed: return ret;
ret;
never executed: return ret;
0
184}-
185-
186void QMenuPrivate::updateActionRects() const-
187{-
188 const QMenu * const q = q_func();-
189 updateActionRects(popupGeometry(q));-
190}
never executed: end of block
0
191-
192void QMenuPrivate::updateActionRects(const QRect &screen) const-
193{-
194 const QMenu * const q = q_func();-
195 if (!itemsDirty
!itemsDirtyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
196 return;
never executed: return;
0
197-
198 q->ensurePolished();-
199-
200-
201 actionRects.resize(actions.count());-
202 actionRects.fill(QRect());-
203-
204 int lastVisibleAction = getLastVisibleAction();-
205-
206 int max_column_width = 0,-
207 dh = screen.height(),-
208 y = 0;-
209 QStyle *style = q->style();-
210 QStyleOption opt;-
211 opt.init(q);-
212 const int hmargin = style->pixelMetric(QStyle::PM_MenuHMargin, &opt, q),-
213 vmargin = style->pixelMetric(QStyle::PM_MenuVMargin, &opt, q),-
214 icone = style->pixelMetric(QStyle::PM_SmallIconSize, &opt, q);-
215 const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, q);-
216 const int deskFw = style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, &opt, q);-
217 const int tearoffHeight = tearoff
tearoffDescription
TRUEnever evaluated
FALSEnever evaluated
? style->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, q) : 0;
0
218-
219-
220 tabWidth = 0;-
221 maxIconWidth = 0;-
222 hasCheckableItems = false;-
223 ncols = 1;-
224-
225 for (int i = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
226 QAction *action = actions.at(i);-
227 if (action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
|| !action->isVisible()
!action->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
|| widgetItems.contains(action)
widgetItems.contains(action)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
228 continue;
never executed: continue;
0
229-
230 hasCheckableItems |= action->isCheckable();-
231 QIcon is = action->icon();-
232 if (!is.isNull()
!is.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
233 maxIconWidth = qMax<uint>(maxIconWidth, icone + 4);-
234 }
never executed: end of block
0
235 }
never executed: end of block
0
236-
237-
238 QFontMetrics qfm = q->fontMetrics();-
239 bool previousWasSeparator = true;-
240 for(int i = 0; i <= lastVisibleAction
i <= lastVisibleActionDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
241 QAction *action = actions.at(i);-
242 const bool isSection = action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&& (!action->text().isEmpty()
!action->text().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !action->icon().isNull()
!action->icon().isNull()Description
TRUEnever evaluated
FALSEnever evaluated
);
0
243 const bool isPlainSeparator = (isSection
isSectionDescription
TRUEnever evaluated
FALSEnever evaluated
&& !q->style()->styleHint(QStyle::SH_Menu_SupportsSections)
!q->style()->s...portsSections)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
244 || (action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&& !isSection
!isSectionDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
245-
246 if (!action->isVisible()
!action->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
247 (collapsibleSeparators
collapsibleSeparatorsDescription
TRUEnever evaluated
FALSEnever evaluated
&& previousWasSeparator
previousWasSeparatorDescription
TRUEnever evaluated
FALSEnever evaluated
&& isPlainSeparator
isPlainSeparatorDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
248 continue;
never executed: continue;
0
249-
250 previousWasSeparator = isPlainSeparator;-
251-
252-
253 QStyleOptionMenuItem opt;-
254 q->initStyleOption(&opt, action);-
255 const QFontMetrics &fm = opt.fontMetrics;-
256-
257 QSize sz;-
258 if (QWidget *w = widgetItems.value(action)
QWidget *w = w....value(action)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
259 sz = w->sizeHint().expandedTo(w->minimumSize()).expandedTo(w->minimumSizeHint()).boundedTo(w->maximumSize());-
260 }
never executed: end of block
else {
0
261-
262 if (action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
263 sz = QSize(2, 2);-
264 }
never executed: end of block
else {
0
265 QString s = action->text();-
266 int t = s.indexOf(QLatin1Char('\t'));-
267 if (t != -1
t != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
268 tabWidth = qMax(int(tabWidth), qfm.width(s.mid(t+1)));-
269 s = s.left(t);-
270-
271 }
never executed: end of block
else {
0
272 QKeySequence seq = action->shortcut();-
273 if (!seq.isEmpty()
!seq.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
274 tabWidth = qMax(int(tabWidth), qfm.width(seq.toString(QKeySequence::NativeText)));
never executed: tabWidth = qMax(int(tabWidth), qfm.width(seq.toString(QKeySequence::NativeText)));
0
275-
276 }
never executed: end of block
0
277 sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width());-
278 sz.setHeight(qMax(fm.height(), qfm.height()));-
279-
280 QIcon is = action->icon();-
281 if (!is.isNull()
!is.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
282 QSize is_sz = QSize(icone, icone);-
283 if (is_sz.height() > sz.height()
is_sz.height() > sz.height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
284 sz.setHeight(is_sz.height());
never executed: sz.setHeight(is_sz.height());
0
285 }
never executed: end of block
0
286 }
never executed: end of block
0
287 sz = style->sizeFromContents(QStyle::CT_MenuItem, &opt, sz, q);-
288 }
never executed: end of block
0
289-
290-
291 if (!sz.isEmpty()
!sz.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
292 max_column_width = qMax(max_column_width, sz.width());-
293-
294 if (!scroll
!scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
295 y+sz.height()+vmargin > dh - (deskFw * 2)
y+sz.height()+...- (deskFw * 2)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
296 ncols++;-
297 y = vmargin;-
298 }
never executed: end of block
0
299 y += sz.height();-
300-
301 actionRects[i] = QRect(0, 0, sz.width(), sz.height());-
302 }
never executed: end of block
0
303 }
never executed: end of block
0
304-
305 max_column_width += tabWidth;-
306 const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width();-
307 const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin));-
308 max_column_width = qMax(min_column_width, max_column_width);-
309-
310-
311 const int base_y = vmargin + fw + topmargin +-
312 (scroll
scrollDescription
TRUEnever evaluated
FALSEnever evaluated
? scroll->scrollOffset : 0) +
0
313 tearoffHeight;-
314 int x = hmargin + fw + leftmargin;-
315 y = base_y;-
316-
317 for(int i = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
318 QRect &rect = actionRects[i];-
319 if (rect.isNull()
rect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
320 continue;
never executed: continue;
0
321 if (!scroll
!scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
322 y+rect.height() > dh - deskFw * 2
y+rect.height(...h - deskFw * 2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
323 x += max_column_width + hmargin;-
324 y = base_y;-
325 }
never executed: end of block
0
326 rect.translate(x, y);-
327 rect.setWidth(max_column_width);-
328-
329-
330 if (QWidget *widget = widgetItems.value(actions.at(i))
QWidget *widge...actions.at(i))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
331 widget->setGeometry(rect);-
332 widget->setVisible(actions.at(i)->isVisible());-
333 }
never executed: end of block
0
334-
335 y += rect.height();-
336 }
never executed: end of block
0
337 itemsDirty = 0;-
338}
never executed: end of block
0
339-
340QSize QMenuPrivate::adjustMenuSizeForScreen(const QRect &screen)-
341{-
342 QMenu * const q = q_func();-
343 QSize ret = screen.size();-
344 itemsDirty = true;-
345 updateActionRects(screen);-
346 const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);-
347 ret.setWidth(actionRects.at(getLastVisibleAction()).right() + fw);-
348 return
never executed: return ret;
ret;
never executed: return ret;
0
349}-
350-
351int QMenuPrivate::getLastVisibleAction() const-
352{-
353-
354 int lastVisibleAction = actions.count() - 1;-
355 for (;lastVisibleAction >= 0
lastVisibleAction >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --lastVisibleAction) {
0
356 const QAction *action = actions.at(lastVisibleAction);-
357 if (action->isVisible()
action->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
358-
359 if (action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&& collapsibleSeparators
collapsibleSeparatorsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
360 continue;
never executed: continue;
0
361 break;
never executed: break;
0
362 }-
363 }
never executed: end of block
0
364 return
never executed: return lastVisibleAction;
lastVisibleAction;
never executed: return lastVisibleAction;
0
365}-
366-
367-
368QRect QMenuPrivate::actionRect(QAction *act) const-
369{-
370 int index = actions.indexOf(act);-
371 if (index == -1
index == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
372 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
373-
374 updateActionRects();-
375-
376-
377 return
never executed: return actionRects.at(index);
actionRects.at(index);
never executed: return actionRects.at(index);
0
378}-
379-
380void QMenuPrivate::hideUpToMenuBar()-
381{-
382 QMenu * const q = q_func();-
383 bool fadeMenus = q->style()->styleHint(QStyle::SH_Menu_FadeOutOnHide);-
384 if (!tornoff
!tornoffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
385 QWidget *caused = causedPopup.widget;-
386 hideMenu(q);-
387 while(caused
causedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
388-
389 if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)
QMenuBar *mb =...uBar*>(caused)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
390 mb->d_func()->setCurrentAction(0);-
391 mb->d_func()->setKeyboardMode(false);-
392 caused = 0;-
393 }
never executed: end of block
else
0
394-
395 if (QMenu *m = qobject_cast<QMenu*>(caused)
QMenu *m = qob...Menu*>(caused)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
396 caused = m->d_func()->causedPopup.widget;-
397 if (!m->d_func()->tornoff
!m->d_func()->tornoffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
398 hideMenu(m);
never executed: hideMenu(m);
0
399 if (!fadeMenus
!fadeMenusDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
400 m->d_func()->setCurrentAction(0);
never executed: m->d_func()->setCurrentAction(0);
0
401 }
never executed: end of block
else { caused = 0;
0
402 }
never executed: end of block
0
403 }-
404 }
never executed: end of block
0
405 setCurrentAction(0);-
406}
never executed: end of block
0
407-
408void QMenuPrivate::hideMenu(QMenu *menu)-
409{-
410 if (!menu
!menuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
411 return;
never executed: return;
0
412-
413 QSignalBlocker blocker(menu);-
414 aboutToHide = true;-
415-
416 if (menu->style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem)
menu->style()-...TriggeredItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
417 && currentAction
currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& currentAction == actionAboutToTrigger
currentAction ...AboutToTriggerDescription
TRUEnever evaluated
FALSEnever evaluated
0
418 && menu->actions().contains(currentAction)
menu->actions(...currentAction)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
419 QEventLoop eventLoop;-
420 QAction *activeAction = currentAction;-
421-
422 menu->setActiveAction(0);-
423 QTimer::singleShot(60, &eventLoop, qFlagLocation("1""quit()" "\0" __FILE__ ":" "480"));-
424 eventLoop.exec();-
425-
426-
427 menu->setActiveAction(activeAction);-
428 QTimer::singleShot(20, &eventLoop, qFlagLocation("1""quit()" "\0" __FILE__ ":" "485"));-
429 eventLoop.exec();-
430 }
never executed: end of block
0
431-
432 aboutToHide = false;-
433 blocker.unblock();-
434-
435 if (activeMenu == menu
activeMenu == menuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
436 activeMenu = 0;
never executed: activeMenu = 0;
0
437 menu->d_func()->causedPopup.action = 0;-
438 menu->close();-
439 menu->d_func()->causedPopup.widget = 0;-
440}
never executed: end of block
0
441-
442void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)-
443{-
444 QMenu * const q = q_func();-
445 if (action
actionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
446 if (action->isEnabled()
action->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
447 if (!delay
!delayDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
448 q->internalDelayedPopup();
never executed: q->internalDelayedPopup();
0
449 else if (action->menu()
action->menu()Description
TRUEnever evaluated
FALSEnever evaluated
&& !action->menu()->isVisible()
!action->menu()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
450 delayState.start(delay, action);
never executed: delayState.start(delay, action);
0
451 else if (!action->menu()
!action->menu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
452 delayState.stop();
never executed: delayState.stop();
0
453 if (activateFirst
activateFirstDescription
TRUEnever evaluated
FALSEnever evaluated
&& action->menu()
action->menu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
454 action->menu()->d_func()->setFirstActionActive();
never executed: action->menu()->d_func()->setFirstActionActive();
0
455 }
never executed: end of block
0
456 }
never executed: end of block
else if (QMenu *menu = activeMenu
QMenu *menu = activeMenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
457 hideMenu(menu);-
458 }
never executed: end of block
0
459}
never executed: end of block
0
460-
461void QMenuPrivate::setSyncAction()-
462{-
463 QMenu * const q = q_func();-
464 QAction *current = currentAction;-
465 if(current
currentDescription
TRUEnever evaluated
FALSEnever evaluated
&& (!current->isEnabled()
!current->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
|| current->menu()
current->menu()Description
TRUEnever evaluated
FALSEnever evaluated
|| current->isSeparator()
current->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
))
0
466 current = 0;
never executed: current = 0;
0
467 for(QWidget *caused = q; caused
causedDescription
TRUEnever evaluated
FALSEnever evaluated
;) {
0
468 if (QMenu *m = qobject_cast<QMenu*>(caused)
QMenu *m = qob...Menu*>(caused)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
469 caused = m->d_func()->causedPopup.widget;-
470 if (m->d_func()->eventLoop
m->d_func()->eventLoopDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
471 m->d_func()->syncAction = current;
never executed: m->d_func()->syncAction = current;
0
472 }
never executed: end of block
else {
0
473 break;
never executed: break;
0
474 }-
475 }-
476}
never executed: end of block
0
477-
478-
479void QMenuPrivate::setFirstActionActive()-
480{-
481 QMenu * const q = q_func();-
482 updateActionRects();-
483 for(int i = 0, saccum = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
484 const QRect &rect = actionRects.at(i);-
485 if (rect.isNull()
rect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
486 continue;
never executed: continue;
0
487 if (scroll
scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& scroll->scrollFlags & QMenuScroller::ScrollUp
scroll->scroll...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
488 saccum -= rect.height();-
489 if (saccum > scroll->scrollOffset - scrollerHeight()
saccum > scrol...rollerHeight()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
490 continue;
never executed: continue;
0
491 }
never executed: end of block
0
492 QAction *act = actions.at(i);-
493 if (!act->isSeparator()
!act->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
494 (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)
q->style()->st...isabled, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
495 || act->isEnabled()
act->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
496 setCurrentAction(act);-
497 break;
never executed: break;
0
498 }-
499 }
never executed: end of block
0
500}
never executed: end of block
0
501-
502-
503void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason reason, bool activateFirst)-
504{-
505 QMenu * const q = q_func();-
506 tearoffHighlighted = 0;-
507-
508 if (action
actionDescription
TRUEnever evaluated
FALSEnever evaluated
0
509 && (action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
0
510 || (!action->isEnabled()
!action->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
&& !q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)
!q->style()->s...isabled, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
)))
0
511 action = nullptr;
never executed: action = nullptr;
0
512-
513-
514-
515 if (reason != SelectedFromKeyboard
reason != SelectedFromKeyboardDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
516 if (QMenu *menu = qobject_cast<QMenu*>(causedPopup.widget)
QMenu *menu = ...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
517 if (causedPopup.action
causedPopup.actionDescription
TRUEnever evaluated
FALSEnever evaluated
&& menu->d_func()->activeMenu == q
menu->d_func()...ctiveMenu == qDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
518-
519 if (hasReceievedEnter
hasReceievedEnterDescription
TRUEnever evaluated
FALSEnever evaluated
&& menu->d_func()->currentAction != causedPopup.action
menu->d_func()...edPopup.actionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
520 menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false);
never executed: menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false);
0
521 }
never executed: end of block
0
522 }
never executed: end of block
0
523-
524 if (currentAction
currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
525 q->update(actionRect(currentAction));
never executed: q->update(actionRect(currentAction));
0
526-
527 QMenu *hideActiveMenu = activeMenu;-
528 QAction *previousAction = currentAction;-
529-
530 currentAction = action;-
531 if (action
actionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
532 if (!action->isSeparator()
!action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
533 activateAction(action, QAction::Hover);-
534 if (popup != -1
popup != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
535-
536-
537-
538 if (q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
539 popupAction(currentAction, popup, activateFirst);
never executed: popupAction(currentAction, popup, activateFirst);
0
540 }
never executed: end of block
0
541 q->update(actionRect(action));-
542-
543 if (reason == SelectedFromKeyboard
reason == SelectedFromKeyboardDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
544 QWidget *widget = widgetItems.value(action);-
545 if (widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
546 if (widget->focusPolicy() != Qt::NoFocus
widget->focusP...!= Qt::NoFocusDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
547 widget->setFocus(Qt::TabFocusReason);
never executed: widget->setFocus(Qt::TabFocusReason);
0
548 }
never executed: end of block
else {
0
549-
550-
551-
552 if (!q->hasFocus()
!q->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
553 q->setFocus(Qt::PopupFocusReason);-
554 }
never executed: end of block
0
555 }
never executed: end of block
0
556 }-
557 }
never executed: end of block
0
558-
559 }
never executed: end of block
else if (previousAction
previousActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
560 previousAction->d_func()->showStatusText(topCausedWidget(), QString());-
561-
562 }
never executed: end of block
0
563 if (hideActiveMenu
hideActiveMenuDescription
TRUEnever evaluated
FALSEnever evaluated
&& previousAction != currentAction
previousAction... currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
564 if (popup == -1
popup == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
565-
566-
567 qFadeEffect(0);-
568 qScrollEffect(0);-
569-
570 hideMenu(hideActiveMenu);-
571 }
never executed: end of block
else if (!currentAction
!currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
|| !currentAction->menu()
!currentAction->menu()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
572 sloppyState.startTimerIfNotRunning();-
573 }
never executed: end of block
0
574 }
never executed: end of block
0
575}
never executed: end of block
0
576-
577void QMenuSloppyState::reset()-
578{-
579 m_enabled = false;-
580 m_first_mouse = true;-
581 m_init_guard = false;-
582 m_uni_dir_discarded_count = 0;-
583 m_time.stop();-
584 m_reset_action = nullptr;-
585 m_origin_action = nullptr;-
586 m_action_rect = QRect();-
587 m_previous_point = QPointF();-
588 if (m_sub_menu
m_sub_menuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
589 QMenuPrivate::get(m_sub_menu)->sloppyState.m_parent = nullptr;-
590 m_sub_menu = nullptr;-
591 }
never executed: end of block
0
592}
never executed: end of block
0
593void QMenuSloppyState::enter()-
594{-
595 QMenuPrivate *menuPriv = QMenuPrivate::get(m_menu);-
596-
597 if (m_discard_state_when_entering_parent
m_discard_stat...ntering_parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& m_sub_menu == menuPriv->activeMenu
m_sub_menu == ...iv->activeMenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
598 menuPriv->hideMenu(m_sub_menu);-
599 reset();-
600 }
never executed: end of block
0
601 if (m_parent
m_parentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
602 m_parent->childEnter();
never executed: m_parent->childEnter();
0
603}
never executed: end of block
0
604-
605void QMenuSloppyState::childEnter()-
606{-
607 stopTimer();-
608 if (m_parent
m_parentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
609 m_parent->childEnter();
never executed: m_parent->childEnter();
0
610}
never executed: end of block
0
611-
612void QMenuSloppyState::leave()-
613{-
614 if (!m_dont_start_time_on_leave
!m_dont_start_time_on_leaveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
615 if (m_parent
m_parentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
616 m_parent->childLeave();
never executed: m_parent->childLeave();
0
617 startTimerIfNotRunning();-
618 }
never executed: end of block
0
619}
never executed: end of block
0
620-
621void QMenuSloppyState::childLeave()-
622{-
623 if (m_enabled
m_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
&& !QMenuPrivate::get(m_menu)->hasReceievedEnter
!QMenuPrivate:...ReceievedEnterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
624 startTimerIfNotRunning();-
625 if (m_parent
m_parentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
626 m_parent->childLeave();
never executed: m_parent->childLeave();
0
627 }
never executed: end of block
0
628}
never executed: end of block
0
629-
630void QMenuSloppyState::setSubMenuPopup(const QRect &actionRect, QAction *resetAction, QMenu *subMenu)-
631{-
632 m_enabled = true;-
633 m_init_guard = true;-
634 m_time.stop();-
635 m_action_rect = actionRect;-
636 m_sub_menu = subMenu;-
637 QMenuPrivate::get(subMenu)->sloppyState.m_parent = this;-
638 m_reset_action = resetAction;-
639 m_origin_action = resetAction;-
640}
never executed: end of block
0
641-
642bool QMenuSloppyState::hasParentActiveDelayTimer() const-
643{-
644 return
never executed: return m_parent && m_parent->m_menu && QMenuPrivate::get(m_parent->m_menu)->delayState.timer.isActive();
m_parent && m_parent->m_menu && QMenuPrivate::get(m_parent->m_menu)->delayState.timer.isActive();
never executed: return m_parent && m_parent->m_menu && QMenuPrivate::get(m_parent->m_menu)->delayState.timer.isActive();
0
645}-
646-
647class ResetOnDestroy-
648{-
649public:-
650 ResetOnDestroy(QMenuSloppyState *sloppyState, bool *guard)-
651 : toReset(sloppyState)-
652 , guard(guard)-
653 {-
654 *guard = false;-
655 }
never executed: end of block
0
656-
657 ~ResetOnDestroy()-
658 {-
659 if (!*guard
!*guardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
660 toReset->reset();
never executed: toReset->reset();
0
661 }
never executed: end of block
0
662-
663 QMenuSloppyState *toReset;-
664 bool *guard;-
665};-
666-
667void QMenuSloppyState::timeout()-
668{-
669 QMenuPrivate *menu_priv = QMenuPrivate::get(m_menu);-
670-
671 bool reallyHasMouse = menu_priv->hasReceievedEnter;-
672 if (!reallyHasMouse
!reallyHasMouseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
673-
674-
675 const QPoint lastCursorPos = QGuiApplicationPrivate::lastCursorPosition.toPoint();-
676 reallyHasMouse = m_menu->frameGeometry().contains(lastCursorPos);-
677 }
never executed: end of block
0
678-
679 if (menu_priv->currentAction == m_reset_action
menu_priv->cur...m_reset_actionDescription
TRUEnever evaluated
FALSEnever evaluated
0
680 && reallyHasMouse
reallyHasMouseDescription
TRUEnever evaluated
FALSEnever evaluated
0
681 && (menu_priv->currentAction
menu_priv->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
0
682 && menu_priv->currentAction->menu() == menu_priv->activeMenu
menu_priv->cur...iv->activeMenuDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
683 return;
never executed: return;
0
684 }-
685-
686 ResetOnDestroy resetState(this, &m_init_guard);-
687-
688 if (hasParentActiveDelayTimer()
hasParentActiveDelayTimer()Description
TRUEnever evaluated
FALSEnever evaluated
|| !m_menu->isVisible()
!m_menu->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
689 return;
never executed: return;
0
690-
691 if (m_sub_menu
m_sub_menuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
692 menu_priv->hideMenu(m_sub_menu);
never executed: menu_priv->hideMenu(m_sub_menu);
0
693-
694 if (reallyHasMouse
reallyHasMouseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
695 menu_priv->setCurrentAction(m_reset_action,0);
never executed: menu_priv->setCurrentAction(m_reset_action,0);
0
696 else-
697 menu_priv->setCurrentAction(nullptr, 0);
never executed: menu_priv->setCurrentAction(nullptr, 0);
0
698}-
699-
700-
701QWidget *QMenuPrivate::topCausedWidget() const-
702{-
703 QWidget* top = causedPopup.widget;-
704 while (QMenu* m = qobject_cast<QMenu *>(top)
QMenu* m = qob...<QMenu *>(top)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
705 top = m->d_func()->causedPopup.widget;
never executed: top = m->d_func()->causedPopup.widget;
0
706 return
never executed: return top;
top;
never executed: return top;
0
707}-
708-
709QAction *QMenuPrivate::actionAt(QPoint p) const-
710{-
711 if (!q_func()->rect().contains(p)
!q_func()->rect().contains(p)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
712 return
never executed: return 0;
0;
never executed: return 0;
0
713-
714 for(int i = 0; i < actionRects.count()
i < actionRects.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
715 if (actionRects.at(i).contains(p)
actionRects.at(i).contains(p)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
716 return
never executed: return actions.at(i);
actions.at(i);
never executed: return actions.at(i);
0
717 }
never executed: end of block
0
718 return
never executed: return 0;
0;
never executed: return 0;
0
719}-
720-
721void QMenuPrivate::setOverrideMenuAction(QAction *a)-
722{-
723 QMenu * const q = q_func();-
724 QObject::disconnect(menuAction, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "781"), q, qFlagLocation("1""_q_overrideMenuActionDestroyed()" "\0" __FILE__ ":" "781"));-
725 if (a
aDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
726 menuAction = a;-
727 QObject::connect(a, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "784"), q, qFlagLocation("1""_q_overrideMenuActionDestroyed()" "\0" __FILE__ ":" "784"));-
728 }
never executed: end of block
else {
0
729 menuAction = defaultMenuAction;-
730 }
never executed: end of block
0
731}-
732-
733void QMenuPrivate::_q_overrideMenuActionDestroyed()-
734{-
735 menuAction=defaultMenuAction;-
736}
never executed: end of block
0
737-
738-
739void QMenuPrivate::updateLayoutDirection()-
740{-
741 QMenu * const q = q_func();-
742-
743-
744-
745 if (!q->testAttribute(Qt::WA_SetLayoutDirection)
!q->testAttrib...youtDirection)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
746 if (QWidget *w = causedPopup.widget
QWidget *w = c...edPopup.widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
747 setLayoutDirection_helper(w->layoutDirection());
never executed: setLayoutDirection_helper(w->layoutDirection());
0
748 else if (QWidget *w = q->parentWidget()
QWidget *w = q->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
749 setLayoutDirection_helper(w->layoutDirection());
never executed: setLayoutDirection_helper(w->layoutDirection());
0
750 else-
751 setLayoutDirection_helper(QApplication::layoutDirection());
never executed: setLayoutDirection_helper(QApplication::layoutDirection());
0
752 }-
753}
never executed: end of block
0
754-
755-
756-
757-
758-
759QAction *QMenu::menuAction() const-
760{-
761 return
never executed: return d_func()->menuAction;
d_func()->menuAction;
never executed: return d_func()->menuAction;
0
762}-
763QString QMenu::title() const-
764{-
765 return
never executed: return d_func()->menuAction->text();
d_func()->menuAction->text();
never executed: return d_func()->menuAction->text();
0
766}-
767-
768void QMenu::setTitle(const QString &text)-
769{-
770 d_func()->menuAction->setText(text);-
771}
never executed: end of block
0
772QIcon QMenu::icon() const-
773{-
774 return
never executed: return d_func()->menuAction->icon();
d_func()->menuAction->icon();
never executed: return d_func()->menuAction->icon();
0
775}-
776-
777void QMenu::setIcon(const QIcon &icon)-
778{-
779 d_func()->menuAction->setIcon(icon);-
780}
never executed: end of block
0
781-
782-
783-
784void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation location, bool active)-
785{-
786 QMenu * const q = q_func();-
787 if (!scroll
!scrollDescription
TRUEnever evaluated
FALSEnever evaluated
|| !scroll->scrollFlags
!scroll->scrollFlagsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
788 return;
never executed: return;
0
789 updateActionRects();-
790 int newOffset = 0;-
791 const int topScroll = (
(scroll->scrol...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
scroll->scrollFlags & QMenuScroller::ScrollUp)
(scroll->scrol...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
? scrollerHeight() : 0;
0
792 const int botScroll = (
(scroll->scrol...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
scroll->scrollFlags & QMenuScroller::ScrollDown)
(scroll->scrol...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
? scrollerHeight() : 0;
0
793 const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q);-
794 const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);-
795-
796 if (location == QMenuScroller::ScrollTop
location == QM...ler::ScrollTopDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
797 for(int i = 0, saccum = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
798 if (actions.at(i) == action
actions.at(i) == actionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
799 newOffset = topScroll - saccum;-
800 break;
never executed: break;
0
801 }-
802 saccum += actionRects.at(i).height();-
803 }
never executed: end of block
0
804 }
never executed: end of block
else {
0
805 for(int i = 0, saccum = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
806 saccum += actionRects.at(i).height();-
807 if (actions.at(i) == action
actions.at(i) == actionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
808 if (location == QMenuScroller::ScrollCenter
location == QM...::ScrollCenterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
809 newOffset = ((q->height() / 2) - botScroll) - (saccum - topScroll);
never executed: newOffset = ((q->height() / 2) - botScroll) - (saccum - topScroll);
0
810 else-
811 newOffset = (q->height() - botScroll) - saccum;
never executed: newOffset = (q->height() - botScroll) - saccum;
0
812 break;
never executed: break;
0
813 }-
814 }
never executed: end of block
0
815 if(newOffset
newOffsetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
816 newOffset -= fw * 2;
never executed: newOffset -= fw * 2;
0
817 }
never executed: end of block
0
818-
819-
820 uint newScrollFlags = QMenuScroller::ScrollNone;-
821 if (newOffset < 0
newOffset < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
822 newScrollFlags |= QMenuScroller::ScrollUp;
never executed: newScrollFlags |= QMenuScroller::ScrollUp;
0
823 int saccum = newOffset;-
824 for(int i = 0; i < actionRects.count()
i < actionRects.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
825 saccum += actionRects.at(i).height();-
826 if (saccum > q->height()
saccum > q->height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
827 newScrollFlags |= QMenuScroller::ScrollDown;-
828 break;
never executed: break;
0
829 }-
830 }
never executed: end of block
0
831-
832 if (!(newScrollFlags & QMenuScroller::ScrollDown)
!(newScrollFla...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(scroll->scrol...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
scroll->scrollFlags & QMenuScroller::ScrollDown)
(scroll->scrol...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
833 newOffset = q->height() - (saccum - newOffset) - fw*2 - vmargin;-
834 }
never executed: end of block
0
835-
836 if (!(newScrollFlags & QMenuScroller::ScrollUp)
!(newScrollFla...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(scroll->scrol...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
scroll->scrollFlags & QMenuScroller::ScrollUp)
(scroll->scrol...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
837 newOffset = 0;-
838 }
never executed: end of block
0
839-
840 if (newScrollFlags & QMenuScroller::ScrollUp
newScrollFlags...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
841 newOffset -= vmargin;
never executed: newOffset -= vmargin;
0
842-
843 QRect screen = popupGeometry(q);-
844 const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q);-
845 if (q->height() < screen.height()-(desktopFrame*2)-1
q->height() < ...ktopFrame*2)-1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
846 QRect geom = q->geometry();-
847 if (newOffset > scroll->scrollOffset
newOffset > sc...->scrollOffsetDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(scroll->scrol...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollUp)
(scroll->scrol...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
848 const int newHeight = geom.height()-(newOffset-scroll->scrollOffset);-
849 if(newHeight > geom.height()
newHeight > geom.height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
850 geom.setHeight(newHeight);
never executed: geom.setHeight(newHeight);
0
851 }
never executed: end of block
else if(scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollDown
scroll->scroll...er::ScrollDownDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
852 int newTop = geom.top() + (newOffset-scroll->scrollOffset);-
853 if (newTop < desktopFrame+screen.top()
newTop < deskt...e+screen.top()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
854 newTop = desktopFrame+screen.top();
never executed: newTop = desktopFrame+screen.top();
0
855 if (newTop < geom.top()
newTop < geom.top()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
856 geom.setTop(newTop);-
857 newOffset = 0;-
858 newScrollFlags &= ~QMenuScroller::ScrollUp;-
859 }
never executed: end of block
0
860 }
never executed: end of block
0
861 if (geom.bottom() > screen.bottom() - desktopFrame
geom.bottom() ...- desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
862 geom.setBottom(screen.bottom() - desktopFrame);
never executed: geom.setBottom(screen.bottom() - desktopFrame);
0
863 if (geom.top() < desktopFrame+screen.top()
geom.top() < d...e+screen.top()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
864 geom.setTop(desktopFrame+screen.top());
never executed: geom.setTop(desktopFrame+screen.top());
0
865 if (geom != q->geometry()
geom != q->geometry()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
866-
867-
868-
869-
870-
871 q->setGeometry(geom);-
872 }
never executed: end of block
0
873 }
never executed: end of block
0
874-
875-
876 const int delta = qMin(0, newOffset) - scroll->scrollOffset;-
877 if (!itemsDirty
!itemsDirtyDescription
TRUEnever evaluated
FALSEnever evaluated
&& delta
deltaDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
878-
879 for (int i = 0; i < actionRects.count()
i < actionRects.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
880 QRect &current = actionRects[i];-
881 current.moveTop(current.top() + delta);-
882-
883-
884 if (QWidget *w = widgetItems.value(actions.at(i))
QWidget *w = w...actions.at(i))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
885 w->setGeometry(current);
never executed: w->setGeometry(current);
0
886 }
never executed: end of block
0
887 }
never executed: end of block
0
888 scroll->scrollOffset += delta;-
889 scroll->scrollFlags = newScrollFlags;-
890 if (active
activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
891 setCurrentAction(action);
never executed: setCurrentAction(action);
0
892-
893 q->update();-
894}
never executed: end of block
0
895-
896void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool active)-
897{-
898 QMenu * const q = q_func();-
899 updateActionRects();-
900 if(location == QMenuScroller::ScrollBottom
location == QM...::ScrollBottomDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
901 for(int i = actions.size()-1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
902 QAction *act = actions.at(i);-
903 if (actionRects.at(i).isNull()
actionRects.at(i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
904 continue;
never executed: continue;
0
905 if (!act->isSeparator()
!act->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
906 (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)
q->style()->st...isabled, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
907 || act->isEnabled()
act->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
908 if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown
scroll->scroll...er::ScrollDownDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
909 scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollBottom, active);
never executed: scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollBottom, active);
0
910 else if(active
activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
911 setCurrentAction(act, -1, QMenuPrivate::SelectedFromKeyboard);
never executed: setCurrentAction(act, -1, QMenuPrivate::SelectedFromKeyboard);
0
912 break;
never executed: break;
0
913 }-
914 }
never executed: end of block
0
915 }
never executed: end of block
else if(location == QMenuScroller::ScrollTop
location == QM...ler::ScrollTopDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
916 for(int i = 0; i < actions.size()
i < actions.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
917 QAction *act = actions.at(i);-
918 if (actionRects.at(i).isNull()
actionRects.at(i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
919 continue;
never executed: continue;
0
920 if (!act->isSeparator()
!act->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
921 (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q)
q->style()->st...isabled, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
922 || act->isEnabled()
act->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
923 if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp
scroll->scroll...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
924 scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollTop, active);
never executed: scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollTop, active);
0
925 else if(active
activeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
926 setCurrentAction(act, -1, QMenuPrivate::SelectedFromKeyboard);
never executed: setCurrentAction(act, -1, QMenuPrivate::SelectedFromKeyboard);
0
927 break;
never executed: break;
0
928 }-
929 }
never executed: end of block
0
930 }
never executed: end of block
0
931}
never executed: end of block
0
932-
933-
934void QMenuPrivate::scrollMenu(QMenuScroller::ScrollDirection direction, bool page, bool active)-
935{-
936 QMenu * const q = q_func();-
937 if (!scroll
!scrollDescription
TRUEnever evaluated
FALSEnever evaluated
|| !(scroll->scrollFlags & direction)
!(scroll->scro...s & direction)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
938 return;
never executed: return;
0
939 updateActionRects();-
940 const int topScroll = (
(scroll->scrol...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
scroll->scrollFlags & QMenuScroller::ScrollUp)
(scroll->scrol...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
? scrollerHeight() : 0;
0
941 const int botScroll = (
(scroll->scrol...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
scroll->scrollFlags & QMenuScroller::ScrollDown)
(scroll->scrol...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
? scrollerHeight() : 0;
0
942 const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q);-
943 const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);-
944 const int offset = topScroll
topScrollDescription
TRUEnever evaluated
FALSEnever evaluated
? topScroll-vmargin : 0;
0
945 if (direction == QMenuScroller::ScrollUp
direction == Q...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
946 for(int i = 0, saccum = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
947 saccum -= actionRects.at(i).height();-
948 if (saccum <= scroll->scrollOffset-offset
saccum <= scro...lOffset-offsetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
949 scrollMenu(actions.at(i), page ? QMenuScroller::ScrollBottom : QMenuScroller::ScrollTop, active);-
950 break;
never executed: break;
0
951 }-
952 }
never executed: end of block
0
953 }
never executed: end of block
else if (direction == QMenuScroller::ScrollDown
direction == Q...er::ScrollDownDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
954 bool scrolled = false;-
955 for(int i = 0, saccum = 0; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
956 const int iHeight = actionRects.at(i).height();-
957 saccum -= iHeight;-
958 if (saccum <= scroll->scrollOffset-offset
saccum <= scro...lOffset-offsetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
959 const int scrollerArea = q->height() - botScroll - fw*2;-
960 int visible = (scroll->scrollOffset-offset) - saccum;-
961 for(i++ ; i < actions.count()
i < actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
962 visible += actionRects.at(i).height();-
963 if (visible > scrollerArea - topScroll
visible > scro...ea - topScrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
964 scrolled = true;-
965 scrollMenu(actions.at(i), page ? QMenuScroller::ScrollTop : QMenuScroller::ScrollBottom, active);-
966 break;
never executed: break;
0
967 }-
968 }
never executed: end of block
0
969 break;
never executed: break;
0
970 }-
971 }
never executed: end of block
0
972 if(!scrolled
!scrolledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
973 scroll->scrollFlags &= ~QMenuScroller::ScrollDown;-
974 q->update();-
975 }
never executed: end of block
0
976 }
never executed: end of block
0
977}
never executed: end of block
0
978-
979-
980-
981bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)-
982{-
983 QMenu * const q = q_func();-
984 QPoint pos = q->mapFromGlobal(e->globalPos());-
985 if (scroll
scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& !activeMenu
!activeMenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
986 bool isScroll = false;-
987 if (pos.x() >= 0
pos.x() >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& pos.x() < q->width()
pos.x() < q->width()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
988 for(int dir = QMenuScroller::ScrollUp; dir <= QMenuScroller::ScrollDown
dir <= QMenuSc...er::ScrollDownDescription
TRUEnever evaluated
FALSEnever evaluated
; dir = dir << 1) {
0
989 if (scroll->scrollFlags & dir
scroll->scrollFlags & dirDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
990 if (dir == QMenuScroller::ScrollUp
dir == QMenuScroller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
991 isScroll = (pos.y() <= scrollerHeight());
never executed: isScroll = (pos.y() <= scrollerHeight());
0
992 else if (dir == QMenuScroller::ScrollDown
dir == QMenuSc...er::ScrollDownDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
993 isScroll = (pos.y() >= q->height() - scrollerHeight());
never executed: isScroll = (pos.y() >= q->height() - scrollerHeight());
0
994 if (isScroll
isScrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
995 scroll->scrollDirection = dir;-
996 break;
never executed: break;
0
997 }-
998 }
never executed: end of block
0
999 }
never executed: end of block
0
1000 }
never executed: end of block
0
1001 if (isScroll
isScrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1002 scroll->scrollTimer.start(50, q);-
1003 return
never executed: return true;
true;
never executed: return true;
0
1004 } else {-
1005 scroll->scrollTimer.stop();-
1006 }
never executed: end of block
0
1007 }-
1008-
1009 if (tearoff
tearoffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1010 QRect tearRect(0, 0, q->width(), q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q));-
1011 if (scroll
scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp
scroll->scroll...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1012 tearRect.translate(0, scrollerHeight());
never executed: tearRect.translate(0, scrollerHeight());
0
1013 q->update(tearRect);-
1014 if (tearRect.contains(pos)
tearRect.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
&& hasMouseMoved(e->globalPos())
hasMouseMoved(e->globalPos())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1015 setCurrentAction(0);-
1016 tearoffHighlighted = 1;-
1017 if (e->type() == QEvent::MouseButtonRelease
e->type() == Q...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1018 if (!tornPopup
!tornPopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1019 tornPopup = new QTornOffMenu(q);
never executed: tornPopup = new QTornOffMenu(q);
0
1020 tornPopup->setGeometry(q->geometry());-
1021 tornPopup->show();-
1022 hideUpToMenuBar();-
1023 }
never executed: end of block
0
1024 return
never executed: return true;
true;
never executed: return true;
0
1025 }-
1026 tearoffHighlighted = 0;-
1027 }
never executed: end of block
0
1028-
1029 if (q->frameGeometry().contains(e->globalPos())
q->frameGeomet...->globalPos())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1030 return
never executed: return false;
false;
never executed: return false;
0
1031-
1032 for(QWidget *caused = causedPopup.widget; caused
causedDescription
TRUEnever evaluated
FALSEnever evaluated
;) {
0
1033 bool passOnEvent = false;-
1034 QWidget *next_widget = 0;-
1035 QPoint cpos = caused->mapFromGlobal(e->globalPos());-
1036-
1037 if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)
QMenuBar *mb =...uBar*>(caused)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1038 passOnEvent = mb->rect().contains(cpos);-
1039 }
never executed: end of block
else
0
1040-
1041 if (QMenu *m = qobject_cast<QMenu*>(caused)
QMenu *m = qob...Menu*>(caused)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1042 passOnEvent = m->rect().contains(cpos);-
1043 next_widget = m->d_func()->causedPopup.widget;-
1044 }
never executed: end of block
0
1045 if (passOnEvent
passOnEventDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1046 if (e->type() != QEvent::MouseButtonRelease
e->type() != Q...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
|| mouseDown == caused
mouseDown == causedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1047 QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->screenPos(),-
1048 e->button(), e->buttons(), e->modifiers(), e->source());-
1049 QApplication::sendEvent(caused, &new_e);-
1050 return
never executed: return true;
true;
never executed: return true;
0
1051 }-
1052 }
never executed: end of block
0
1053 caused = next_widget;-
1054 if (!caused
!causedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1055 sloppyState.leave();
never executed: sloppyState.leave();
0
1056 }
never executed: end of block
0
1057 return
never executed: return false;
false;
never executed: return false;
0
1058}-
1059-
1060void QMenuPrivate::activateCausedStack(const QVector<QPointer<QWidget> > &causedStack, QAction *action, QAction::ActionEvent action_e, bool self)-
1061{-
1062 QBoolBlocker guard(activationRecursionGuard);-
1063 if(self
selfDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1064 action->activate(action_e);
never executed: action->activate(action_e);
0
1065-
1066 for(int i = 0; i < causedStack.size()
i < causedStack.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1067 QPointer<QWidget> widget = causedStack.at(i);-
1068 if (!widget
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1069 continue;
never executed: continue;
0
1070-
1071 if (QMenu *qmenu = qobject_cast<QMenu*>(widget)
QMenu *qmenu =...Menu*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1072 widget = qmenu->d_func()->causedPopup.widget;-
1073 if (action_e == QAction::Trigger
action_e == QAction::TriggerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1074 qmenu->triggered(action);-
1075 }
never executed: end of block
else if (action_e == QAction::Hover
action_e == QAction::HoverDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1076 qmenu->hovered(action);-
1077 }
never executed: end of block
0
1078-
1079 }
never executed: end of block
else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)
QMenuBar *qmen...uBar*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1080 if (action_e == QAction::Trigger
action_e == QAction::TriggerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1081 qmenubar->triggered(action);-
1082 }
never executed: end of block
else if (action_e == QAction::Hover
action_e == QAction::HoverDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1083 qmenubar->hovered(action);-
1084 }
never executed: end of block
0
1085 break;
never executed: break;
0
1086-
1087 }-
1088 }
never executed: end of block
0
1089}
never executed: end of block
0
1090-
1091void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e, bool self)-
1092{-
1093 QMenu * const q = q_func();-
1094-
1095 bool inWhatsThisMode = QWhatsThis::inWhatsThisMode();-
1096-
1097 if (!action
!actionDescription
TRUEnever evaluated
FALSEnever evaluated
|| !q->isEnabled()
!q->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
1098 || (action_e == QAction::Trigger
action_e == QAction::TriggerDescription
TRUEnever evaluated
FALSEnever evaluated
0
1099-
1100 && !inWhatsThisMode
!inWhatsThisModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1101-
1102 && (action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
||!action->isEnabled()
!action->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)))
0
1103 return;
never executed: return;
0
1104-
1105-
1106-
1107-
1108 const QVector<QPointer<QWidget> > causedStack = calcCausedStack();-
1109 if (action_e == QAction::Trigger
action_e == QAction::TriggerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1110-
1111 if (!inWhatsThisMode
!inWhatsThisModeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1112 actionAboutToTrigger = action;
never executed: actionAboutToTrigger = action;
0
1113-
1114-
1115 if (q->testAttribute(Qt::WA_DontShowOnScreen)
q->testAttribu...tShowOnScreen)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1116 hideUpToMenuBar();-
1117 }
never executed: end of block
else {
0
1118 for(QWidget *widget = QApplication::activePopupWidget(); widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
; ) {
0
1119 if (QMenu *qmenu = qobject_cast<QMenu*>(widget)
QMenu *qmenu =...Menu*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1120 if(qmenu == q
qmenu == qDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1121 hideUpToMenuBar();
never executed: hideUpToMenuBar();
0
1122 widget = qmenu->d_func()->causedPopup.widget;-
1123 }
never executed: end of block
else {
0
1124 break;
never executed: break;
0
1125 }-
1126 }-
1127 }
never executed: end of block
0
1128-
1129-
1130 if (inWhatsThisMode
inWhatsThisModeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1131 QString s = action->whatsThis();-
1132 if (s.isEmpty()
s.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1133 s = whatsThis;
never executed: s = whatsThis;
0
1134 QWhatsThis::showText(q->mapToGlobal(actionRect(action).center()), s, q);-
1135 return;
never executed: return;
0
1136 }-
1137-
1138 }
never executed: end of block
0
1139-
1140-
1141 activateCausedStack(causedStack, action, action_e, self);-
1142-
1143-
1144 if (action_e == QAction::Hover
action_e == QAction::HoverDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1145-
1146 if (QAccessible::isActive()
QAccessible::isActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1147 int actionIndex = indexOf(action);-
1148 QAccessibleEvent focusEvent(q, QAccessible::Focus);-
1149 focusEvent.setChild(actionIndex);-
1150 QAccessible::updateAccessibility(&focusEvent);-
1151 }
never executed: end of block
0
1152-
1153 action->showStatusText(topCausedWidget());-
1154 }
never executed: end of block
else {
0
1155 actionAboutToTrigger = 0;-
1156 }
never executed: end of block
0
1157}-
1158-
1159void QMenuPrivate::_q_actionTriggered()-
1160{-
1161 QMenu * const q = q_func();-
1162 if (QAction *action = qobject_cast<QAction *>(q->sender())
QAction *actio...>(q->sender())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1163 QPointer<QAction> actionGuard = action;-
1164 if (platformMenu
platformMenuDescription
TRUEnever evaluated
FALSEnever evaluated
&& widgetItems.value(action)
widgetItems.value(action)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1165 platformMenu->dismiss();
never executed: platformMenu->dismiss();
0
1166 q->triggered(action);-
1167 if (!activationRecursionGuard
!activationRecursionGuardDescription
TRUEnever evaluated
FALSEnever evaluated
&& actionGuard
actionGuardDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1168-
1169-
1170 QVector< QPointer<QWidget> > list;-
1171 for(QWidget *widget = q->parentWidget(); widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
; ) {
0
1172 if (qobject_cast<QMenu*>(widget)
qobject_cast<QMenu*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
1173-
1174 || qobject_cast<QMenuBar*>(widget)
qobject_cast<Q...uBar*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
1175-
1176 ) {-
1177 list.append(widget);-
1178 widget = widget->parentWidget();-
1179 }
never executed: end of block
else {
0
1180 break;
never executed: break;
0
1181 }-
1182 }-
1183 activateCausedStack(list, action, QAction::Trigger, false);-
1184 }
never executed: end of block
0
1185 }
never executed: end of block
0
1186}
never executed: end of block
0
1187-
1188void QMenuPrivate::_q_actionHovered()-
1189{-
1190 QMenu * const q = q_func();-
1191 if (QAction * action = qobject_cast<QAction *>(q->sender())
QAction * acti...>(q->sender())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1192 q->hovered(action);-
1193 }
never executed: end of block
0
1194}
never executed: end of block
0
1195-
1196void QMenuPrivate::_q_platformMenuAboutToShow()-
1197{-
1198 QMenu * const q = q_func();-
1199 q->aboutToShow();-
1200}
never executed: end of block
0
1201-
1202bool QMenuPrivate::hasMouseMoved(const QPoint &globalPos)-
1203{-
1204-
1205-
1206-
1207 return
never executed: return motions > 6 || QApplication::startDragDistance() < (mousePopupPos - globalPos).manhattanLength();
motions > 6 ||
never executed: return motions > 6 || QApplication::startDragDistance() < (mousePopupPos - globalPos).manhattanLength();
0
1208 QApplication::startDragDistance() < (mousePopupPos - globalPos).manhattanLength();
never executed: return motions > 6 || QApplication::startDragDistance() < (mousePopupPos - globalPos).manhattanLength();
0
1209}-
1210void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const-
1211{-
1212 if (!option
!optionDescription
TRUEnever evaluated
FALSEnever evaluated
|| !action
!actionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1213 return;
never executed: return;
0
1214-
1215 const QMenuPrivate * const d = d_func();-
1216 option->initFrom(this);-
1217 option->palette = palette();-
1218 option->state = QStyle::State_None;-
1219-
1220 if (window()->isActiveWindow()
window()->isActiveWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1221 option->state |= QStyle::State_Active;
never executed: option->state |= QStyle::State_Active;
0
1222 if (isEnabled()
isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
&& action->isEnabled()
action->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
1223 && (!action->menu()
!action->menu()Description
TRUEnever evaluated
FALSEnever evaluated
|| action->menu()->isEnabled()
action->menu()->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
))
0
1224 option->state |= QStyle::State_Enabled;
never executed: option->state |= QStyle::State_Enabled;
0
1225 else-
1226 option->palette.setCurrentColorGroup(QPalette::Disabled);
never executed: option->palette.setCurrentColorGroup(QPalette::Disabled);
0
1227-
1228 option->font = action->font().resolve(font());-
1229 option->fontMetrics = QFontMetrics(option->font);-
1230-
1231 if (d->currentAction
d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->currentAction == action
d->currentAction == actionDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->currentAction->isSeparator()
!d->currentAct...>isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1232 option->state |= QStyle::State_Selected-
1233 | (d->mouseDown ? QStyle::State_Sunken : QStyle::State_None);-
1234 }
never executed: end of block
0
1235-
1236 option->menuHasCheckableItems = d->hasCheckableItems;-
1237 if (!action->isCheckable()
!action->isCheckable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1238 option->checkType = QStyleOptionMenuItem::NotCheckable;-
1239 }
never executed: end of block
else {
0
1240 option->checkType = (action->actionGroup()
action->actionGroup()Description
TRUEnever evaluated
FALSEnever evaluated
&& action->actionGroup()->isExclusive()
action->action...>isExclusive()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1241 ? QStyleOptionMenuItem::Exclusive : QStyleOptionMenuItem::NonExclusive;-
1242 option->checked = action->isChecked();-
1243 }
never executed: end of block
0
1244 if (action->menu()
action->menu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1245 option->menuItemType = QStyleOptionMenuItem::SubMenu;
never executed: option->menuItemType = QStyleOptionMenuItem::SubMenu;
0
1246 else if (action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1247 option->menuItemType = QStyleOptionMenuItem::Separator;
never executed: option->menuItemType = QStyleOptionMenuItem::Separator;
0
1248 else if (d->defaultAction == action
d->defaultAction == actionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1249 option->menuItemType = QStyleOptionMenuItem::DefaultItem;
never executed: option->menuItemType = QStyleOptionMenuItem::DefaultItem;
0
1250 else-
1251 option->menuItemType = QStyleOptionMenuItem::Normal;
never executed: option->menuItemType = QStyleOptionMenuItem::Normal;
0
1252 if (action->isIconVisibleInMenu()
action->isIconVisibleInMenu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1253 option->icon = action->icon();
never executed: option->icon = action->icon();
0
1254 QString textAndAccel = action->text();-
1255-
1256 if (textAndAccel.indexOf(QLatin1Char('\t')) == -1
textAndAccel.i...r('\t')) == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1257 QKeySequence seq = action->shortcut();-
1258 if (!seq.isEmpty()
!seq.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1259 textAndAccel += QLatin1Char('\t') + seq.toString(QKeySequence::NativeText);
never executed: textAndAccel += QLatin1Char('\t') + seq.toString(QKeySequence::NativeText);
0
1260 }
never executed: end of block
0
1261-
1262 option->text = textAndAccel;-
1263 option->tabWidth = d->tabWidth;-
1264 option->maxIconWidth = d->maxIconWidth;-
1265 option->menuRect = rect();-
1266}
never executed: end of block
0
1267QMenu::QMenu(QWidget *parent)-
1268 : QWidget(*new QMenuPrivate, parent, Qt::Popup)-
1269{-
1270 QMenuPrivate * const d = d_func();-
1271 d->init();-
1272}
never executed: end of block
0
1273QMenu::QMenu(const QString &title, QWidget *parent)-
1274 : QWidget(*new QMenuPrivate, parent, Qt::Popup)-
1275{-
1276 QMenuPrivate * const d = d_func();-
1277 d->init();-
1278 d->menuAction->setText(title);-
1279}
never executed: end of block
0
1280-
1281-
1282-
1283QMenu::QMenu(QMenuPrivate &dd, QWidget *parent)-
1284 : QWidget(dd, parent, Qt::Popup)-
1285{-
1286 QMenuPrivate * const d = d_func();-
1287 d->init();-
1288}
never executed: end of block
0
1289-
1290-
1291-
1292-
1293QMenu::~QMenu()-
1294{-
1295 QMenuPrivate * const d = d_func();-
1296 if (!d->widgetItems.isEmpty()
!d->widgetItems.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1297 QHash<QAction *, QWidget *>::iterator it = d->widgetItems.begin();-
1298 for (; it != d->widgetItems.end()
it != d->widgetItems.end()Description
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
1299 if (QWidget *widget = it.value()
QWidget *widget = it.value()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1300 QWidgetAction *action = static_cast<QWidgetAction *>(it.key());-
1301 action->releaseWidget(widget);-
1302 *it = 0;-
1303 }
never executed: end of block
0
1304 }
never executed: end of block
0
1305 }
never executed: end of block
0
1306-
1307 if (d->eventLoop
d->eventLoopDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1308 d->eventLoop->exit();
never executed: d->eventLoop->exit();
0
1309 hideTearOffMenu();-
1310}
never executed: end of block
0
1311QAction *QMenu::addAction(const QString &text)-
1312{-
1313 QAction *ret = new QAction(text, this);-
1314 addAction(ret);-
1315 return
never executed: return ret;
ret;
never executed: return ret;
0
1316}-
1317QAction *QMenu::addAction(const QIcon &icon, const QString &text)-
1318{-
1319 QAction *ret = new QAction(icon, text, this);-
1320 addAction(ret);-
1321 return
never executed: return ret;
ret;
never executed: return ret;
0
1322}-
1323QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut)-
1324{-
1325 QAction *action = new QAction(text, this);-
1326-
1327-
1328-
1329 action->setShortcut(shortcut);-
1330-
1331 QObject::connect(action, qFlagLocation("2""triggered(bool)" "\0" __FILE__ ":" "1577"), receiver, member);-
1332 addAction(action);-
1333 return
never executed: return action;
action;
never executed: return action;
0
1334}-
1335QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver,-
1336 const char* member, const QKeySequence &shortcut)-
1337{-
1338 QAction *action = new QAction(icon, text, this);-
1339-
1340-
1341-
1342 action->setShortcut(shortcut);-
1343-
1344 QObject::connect(action, qFlagLocation("2""triggered(bool)" "\0" __FILE__ ":" "1698"), receiver, member);-
1345 addAction(action);-
1346 return
never executed: return action;
action;
never executed: return action;
0
1347}-
1348QAction *QMenu::addMenu(QMenu *menu)-
1349{-
1350 QAction *action = menu->menuAction();-
1351 addAction(action);-
1352 return
never executed: return action;
action;
never executed: return action;
0
1353}-
1354-
1355-
1356-
1357-
1358-
1359-
1360-
1361QMenu *QMenu::addMenu(const QString &title)-
1362{-
1363 QMenu *menu = new QMenu(title, this);-
1364 addAction(menu->menuAction());-
1365 return
never executed: return menu;
menu;
never executed: return menu;
0
1366}-
1367-
1368-
1369-
1370-
1371-
1372-
1373-
1374QMenu *QMenu::addMenu(const QIcon &icon, const QString &title)-
1375{-
1376 QMenu *menu = new QMenu(title, this);-
1377 menu->setIcon(icon);-
1378 addAction(menu->menuAction());-
1379 return
never executed: return menu;
menu;
never executed: return menu;
0
1380}-
1381QAction *QMenu::addSeparator()-
1382{-
1383 QAction *action = new QAction(this);-
1384 action->setSeparator(true);-
1385 addAction(action);-
1386 return
never executed: return action;
action;
never executed: return action;
0
1387}-
1388QAction *QMenu::addSection(const QString &text)-
1389{-
1390 QAction *action = new QAction(text, this);-
1391 action->setSeparator(true);-
1392 addAction(action);-
1393 return
never executed: return action;
action;
never executed: return action;
0
1394}-
1395QAction *QMenu::addSection(const QIcon &icon, const QString &text)-
1396{-
1397 QAction *action = new QAction(icon, text, this);-
1398 action->setSeparator(true);-
1399 addAction(action);-
1400 return
never executed: return action;
action;
never executed: return action;
0
1401}-
1402-
1403-
1404-
1405-
1406-
1407-
1408-
1409QAction *QMenu::insertMenu(QAction *before, QMenu *menu)-
1410{-
1411 QAction *action = menu->menuAction();-
1412 insertAction(before, action);-
1413 return
never executed: return action;
action;
never executed: return action;
0
1414}-
1415QAction *QMenu::insertSeparator(QAction *before)-
1416{-
1417 QAction *action = new QAction(this);-
1418 action->setSeparator(true);-
1419 insertAction(before, action);-
1420 return
never executed: return action;
action;
never executed: return action;
0
1421}-
1422QAction *QMenu::insertSection(QAction *before, const QString &text)-
1423{-
1424 QAction *action = new QAction(text, this);-
1425 action->setSeparator(true);-
1426 insertAction(before, action);-
1427 return
never executed: return action;
action;
never executed: return action;
0
1428}-
1429QAction *QMenu::insertSection(QAction *before, const QIcon &icon, const QString &text)-
1430{-
1431 QAction *action = new QAction(icon, text, this);-
1432 action->setSeparator(true);-
1433 insertAction(before, action);-
1434 return
never executed: return action;
action;
never executed: return action;
0
1435}-
1436void QMenu::setDefaultAction(QAction *act)-
1437{-
1438 d_func()->defaultAction = act;-
1439}
never executed: end of block
0
1440-
1441-
1442-
1443-
1444-
1445-
1446QAction *QMenu::defaultAction() const-
1447{-
1448 return
never executed: return d_func()->defaultAction;
d_func()->defaultAction;
never executed: return d_func()->defaultAction;
0
1449}-
1450void QMenu::setTearOffEnabled(bool b)-
1451{-
1452 QMenuPrivate * const d = d_func();-
1453 if (d->tearoff == b
d->tearoff == bDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1454 return;
never executed: return;
0
1455 if (!b
!bDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1456 hideTearOffMenu();
never executed: hideTearOffMenu();
0
1457 d->tearoff = b;-
1458-
1459 d->itemsDirty = true;-
1460 if (isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1461 resize(sizeHint());
never executed: resize(sizeHint());
0
1462}
never executed: end of block
0
1463-
1464bool QMenu::isTearOffEnabled() const-
1465{-
1466 return
never executed: return d_func()->tearoff;
d_func()->tearoff;
never executed: return d_func()->tearoff;
0
1467}-
1468bool QMenu::isTearOffMenuVisible() const-
1469{-
1470 if (d_func()->tornPopup
d_func()->tornPopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1471 return
never executed: return d_func()->tornPopup->isVisible();
d_func()->tornPopup->isVisible();
never executed: return d_func()->tornPopup->isVisible();
0
1472 return
never executed: return false;
false;
never executed: return false;
0
1473}-
1474void QMenu::showTearOffMenu(const QPoint &pos)-
1475{-
1476 QMenuPrivate * const d = d_func();-
1477 if (!d->tornPopup
!d->tornPopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1478 d->tornPopup = new QTornOffMenu(this);
never executed: d->tornPopup = new QTornOffMenu(this);
0
1479 const QSize &s = sizeHint();-
1480 d->tornPopup->setGeometry(pos.x(), pos.y(), s.width(), s.height());-
1481 d->tornPopup->show();-
1482}
never executed: end of block
0
1483void QMenu::showTearOffMenu()-
1484{-
1485 showTearOffMenu(QCursor::pos());-
1486}
never executed: end of block
0
1487-
1488-
1489-
1490-
1491-
1492-
1493-
1494void QMenu::hideTearOffMenu()-
1495{-
1496 QMenuPrivate * const d = d_func();-
1497 if (d->tornPopup
d->tornPopupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1498 d->tornPopup->close();-
1499-
1500-
1501-
1502-
1503 d->tornPopup = nullptr;-
1504 }
never executed: end of block
0
1505}
never executed: end of block
0
1506-
1507-
1508-
1509-
1510-
1511void QMenu::setActiveAction(QAction *act)-
1512{-
1513 QMenuPrivate * const d = d_func();-
1514 d->setCurrentAction(act, 0);-
1515 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1516 d->scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollCenter);
never executed: d->scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollCenter);
0
1517}
never executed: end of block
0
1518-
1519-
1520-
1521-
1522-
1523-
1524QAction *QMenu::activeAction() const-
1525{-
1526 return
never executed: return d_func()->currentAction;
d_func()->currentAction;
never executed: return d_func()->currentAction;
0
1527}-
1528bool QMenu::isEmpty() const-
1529{-
1530 bool ret = true;-
1531 for(int i = 0; ret
retDescription
TRUEnever evaluated
FALSEnever evaluated
&& i < actions().count()
i < actions().count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1532 const QAction *action = actions().at(i);-
1533 if (!action->isSeparator()
!action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&& action->isVisible()
action->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1534 ret = false;-
1535 }
never executed: end of block
0
1536 }
never executed: end of block
0
1537 return
never executed: return ret;
ret;
never executed: return ret;
0
1538}-
1539-
1540-
1541-
1542-
1543-
1544-
1545-
1546void QMenu::clear()-
1547{-
1548 QList<QAction*> acts = actions();-
1549-
1550 for(int i = 0; i < acts.size()
i < acts.size()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1551 removeAction(acts[i]);-
1552 if (acts[i]->parent() == this
acts[i]->parent() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
&& acts[i]->d_func()->widgets.isEmpty()
acts[i]->d_fun...gets.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1553 delete acts[i];
never executed: delete acts[i];
0
1554 }
never executed: end of block
0
1555}
never executed: end of block
0
1556int QMenu::columnCount() const-
1557{-
1558 return
never executed: return d_func()->ncols;
d_func()->ncols;
never executed: return d_func()->ncols;
0
1559}-
1560-
1561-
1562-
1563-
1564QAction *QMenu::actionAt(const QPoint &pt) const-
1565{-
1566 if (QAction *ret = d_func()->actionAt(pt)
QAction *ret =...->actionAt(pt)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1567 return
never executed: return ret;
ret;
never executed: return ret;
0
1568 return
never executed: return 0;
0;
never executed: return 0;
0
1569}-
1570-
1571-
1572-
1573-
1574QRect QMenu::actionGeometry(QAction *act) const-
1575{-
1576 return
never executed: return d_func()->actionRect(act);
d_func()->actionRect(act);
never executed: return d_func()->actionRect(act);
0
1577}-
1578-
1579-
1580-
1581-
1582QSize QMenu::sizeHint() const-
1583{-
1584 const QMenuPrivate * const d = d_func();-
1585 d->updateActionRects();-
1586-
1587 QSize s;-
1588 for (int i = 0; i < d->actionRects.count()
i < d->actionRects.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1589 const QRect &rect = d->actionRects.at(i);-
1590 if (rect.isNull()
rect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1591 continue;
never executed: continue;
0
1592 if (rect.bottom() >= s.height()
rect.bottom() >= s.height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1593 s.setHeight(rect.y() + rect.height());
never executed: s.setHeight(rect.y() + rect.height());
0
1594 if (rect.right() >= s.width()
rect.right() >= s.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1595 s.setWidth(rect.x() + rect.width());
never executed: s.setWidth(rect.x() + rect.width());
0
1596 }
never executed: end of block
0
1597-
1598-
1599-
1600 QStyleOption opt(0);-
1601 opt.init(this);-
1602 const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, this);-
1603 s.rwidth() += style()->pixelMetric(QStyle::PM_MenuHMargin, &opt, this) + fw + d->rightmargin;-
1604 s.rheight() += style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, this) + fw + d->bottommargin;-
1605-
1606 return
never executed: return style()->sizeFromContents(QStyle::CT_Menu, &opt, s.expandedTo(QApplication::globalStrut()), this);
style()->sizeFromContents(QStyle::CT_Menu, &opt,
never executed: return style()->sizeFromContents(QStyle::CT_Menu, &opt, s.expandedTo(QApplication::globalStrut()), this);
0
1607 s.expandedTo(QApplication::globalStrut()), this);
never executed: return style()->sizeFromContents(QStyle::CT_Menu, &opt, s.expandedTo(QApplication::globalStrut()), this);
0
1608}-
1609void QMenu::popup(const QPoint &p, QAction *atAction)-
1610{-
1611 QMenuPrivate * const d = d_func();-
1612 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1613 if (d->scroll->scrollOffset
d->scroll->scrollOffsetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1614 d->itemsDirty = 1;
never executed: d->itemsDirty = 1;
0
1615 d->scroll->scrollOffset = 0;-
1616 d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;-
1617 }
never executed: end of block
0
1618 d->tearoffHighlighted = 0;-
1619 d->motions = 0;-
1620 d->doChildEffects = true;-
1621 d->updateLayoutDirection();-
1622-
1623-
1624-
1625-
1626 setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0);-
1627-
1628-
1629 ensurePolished();-
1630 aboutToShow();-
1631 const bool actionListChanged = d->itemsDirty;-
1632 d->updateActionRects();-
1633 QPoint pos;-
1634 QPushButton *causedButton = qobject_cast<QPushButton*>(d->causedPopup.widget);-
1635 if (actionListChanged
actionListChangedDescription
TRUEnever evaluated
FALSEnever evaluated
&& causedButton
causedButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1636 pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition();
never executed: pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition();
0
1637 else-
1638 pos = p;
never executed: pos = p;
0
1639-
1640 QSize size = sizeHint();-
1641 QRect screen;-
1642-
1643 bool isEmbedded = !bypassGraphicsProxyWidget(this)
!bypassGraphic...xyWidget(this)Description
TRUEnever evaluated
FALSEnever evaluated
&& d->nearestGraphicsProxyWidget(this)
d->nearestGrap...xyWidget(this)Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1644 if (isEmbedded
isEmbeddedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1645 screen = d->popupGeometry(this);
never executed: screen = d->popupGeometry(this);
0
1646 else-
1647-
1648 screen = d->popupGeometry(QApplication::desktop()->screenNumber(p));
never executed: screen = d->popupGeometry(QApplication::desktop()->screenNumber(p));
0
1649 const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this);-
1650 bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen);-
1651-
1652-
1653 if (size.height() > screen.height()
size.height() ...creen.height()Description
TRUEnever evaluated
FALSEnever evaluated
|| size.width() > screen.width()
size.width() > screen.width()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1654 size = d->adjustMenuSizeForScreen(screen);-
1655 adjustToDesktop = true;-
1656 }
never executed: end of block
0
1657-
1658 if (d->ncols >1
d->ncols >1Description
TRUEnever evaluated
FALSEnever evaluated
&& size.height() < screen.height()
size.height() ...creen.height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1659 size = d->adjustMenuSizeForScreen(screen);-
1660 adjustToDesktop = true;-
1661 }
never executed: end of block
0
1662 if (d->ncols > 1
d->ncols > 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1663 pos.setY(screen.top() + desktopFrame);-
1664 }
never executed: end of block
else if (atAction
atActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1665 for (int i = 0, above_height = 0; i < d->actions.count()
i < d->actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1666 QAction *action = d->actions.at(i);-
1667 if (action == atAction
action == atActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1668 int newY = pos.y() - above_height;-
1669 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& newY < desktopFrame
newY < desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1670 d->scroll->scrollFlags = d->scroll->scrollFlags-
1671 | QMenuPrivate::QMenuScroller::ScrollUp;-
1672 d->scroll->scrollOffset = newY;-
1673 newY = desktopFrame;-
1674 }
never executed: end of block
0
1675 pos.setY(newY);-
1676-
1677 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->scroll->scrollFlags != QMenuPrivate::QMenuScroller::ScrollNone
d->scroll->scr...er::ScrollNoneDescription
TRUEnever evaluated
FALSEnever evaluated
0
1678 && !style()->styleHint(QStyle::SH_Menu_FillScreenWithScroll, 0, this)
!style()->styl...roll, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1679 int below_height = above_height + d->scroll->scrollOffset;-
1680 for (int i2 = i; i2 < d->actionRects.count()
i2 < d->actionRects.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i2++)
0
1681 below_height += d->actionRects.at(i2).height();
never executed: below_height += d->actionRects.at(i2).height();
0
1682 size.setHeight(below_height);-
1683 }
never executed: end of block
0
1684 break;
never executed: break;
0
1685 } else {-
1686 above_height += d->actionRects.at(i).height();-
1687 }
never executed: end of block
0
1688 }-
1689 }
never executed: end of block
0
1690-
1691 QPoint mouse = QCursor::pos();-
1692 d->mousePopupPos = mouse;-
1693 const bool snapToMouse = !d->causedPopup.widget
!d->causedPopup.widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(QRect(p.x() -...ntains(mouse))Description
TRUEnever evaluated
FALSEnever evaluated
QRect(p.x() - 3, p.y() - 3, 6, 6).contains(mouse))
(QRect(p.x() -...ntains(mouse))Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1694-
1695 const QSize menuSize(sizeHint());-
1696 if (adjustToDesktop
adjustToDesktopDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1697-
1698 if (isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1699 if (snapToMouse
snapToMouseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1700 pos.setX(mouse.x() - size.width());
never executed: pos.setX(mouse.x() - size.width());
0
1701-
1702-
1703-
1704 if (qobject_cast<QMenuBar*>(d->causedPopup.widget)
qobject_cast<Q...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
|| qobject_cast<QMenu*>(d->causedPopup.widget)
qobject_cast<Q...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1705 pos.rx() -= size.width();
never executed: pos.rx() -= size.width();
0
1706-
1707-
1708 if (pos.x() < screen.left() + desktopFrame
pos.x() < scre...+ desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1709 pos.setX(qMax(p.x(), screen.left() + desktopFrame));
never executed: pos.setX(qMax(p.x(), screen.left() + desktopFrame));
0
1710 if (pos.x() + size.width() - 1 > screen.right() - desktopFrame
pos.x() + size...- desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1711 pos.setX(qMax(p.x() - size.width(), screen.right() - desktopFrame - size.width() + 1));
never executed: pos.setX(qMax(p.x() - size.width(), screen.right() - desktopFrame - size.width() + 1));
0
1712 }
never executed: end of block
else {
0
1713 if (pos.x() + size.width() - 1 > screen.right() - desktopFrame
pos.x() + size...- desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1714 pos.setX(screen.right() - desktopFrame - size.width() + 1);
never executed: pos.setX(screen.right() - desktopFrame - size.width() + 1);
0
1715 if (pos.x() < screen.left() + desktopFrame
pos.x() < scre...+ desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1716 pos.setX(screen.left() + desktopFrame);
never executed: pos.setX(screen.left() + desktopFrame);
0
1717 }
never executed: end of block
0
1718 if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame
pos.y() + size...- desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1719 if(snapToMouse
snapToMouseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1720 pos.setY(qMin(mouse.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1));
never executed: pos.setY(qMin(mouse.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1));
0
1721 else-
1722 pos.setY(qMax(p.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1));
never executed: pos.setY(qMax(p.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1));
0
1723 } else if (pos.y() < screen.top() + desktopFrame
pos.y() < scre...+ desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1724 pos.setY(screen.top() + desktopFrame);-
1725 }
never executed: end of block
0
1726-
1727 if (pos.y() < screen.top() + desktopFrame
pos.y() < scre...+ desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1728 pos.setY(screen.top() + desktopFrame);
never executed: pos.setY(screen.top() + desktopFrame);
0
1729 if (pos.y() + menuSize.height() - 1 > screen.bottom() - desktopFrame
pos.y() + menu...- desktopFrameDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1730 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1731 d->scroll->scrollFlags |= uint(QMenuPrivate::QMenuScroller::ScrollDown);-
1732 int y = qMax(screen.y(),pos.y());-
1733 size.setHeight(screen.bottom() - (desktopFrame * 2) - y);-
1734 }
never executed: end of block
else {
0
1735-
1736 pos.setY(screen.bottom() - size.height() + 1);-
1737 }
never executed: end of block
0
1738 }-
1739 }
never executed: end of block
0
1740 const int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this);-
1741 QMenu *caused = qobject_cast<QMenu*>(d_func()->causedPopup.widget);-
1742 if (caused
causedDescription
TRUEnever evaluated
FALSEnever evaluated
&& caused->geometry().width() + menuSize.width() + subMenuOffset < screen.width()
caused->geomet...screen.width()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1743 QRect parentActionRect(caused->d_func()->actionRect(caused->d_func()->currentAction));-
1744 const QPoint actionTopLeft = caused->mapToGlobal(parentActionRect.topLeft());-
1745 parentActionRect.moveTopLeft(actionTopLeft);-
1746 if (isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1747 if ((
(pos.x() + men...subMenuOffset)Description
TRUEnever evaluated
FALSEnever evaluated
pos.x() + menuSize.width() > parentActionRect.left() - subMenuOffset)
(pos.x() + men...subMenuOffset)Description
TRUEnever evaluated
FALSEnever evaluated
0
1748 && (
(pos.x() < par...nRect.right())Description
TRUEnever evaluated
FALSEnever evaluated
pos.x() < parentActionRect.right())
(pos.x() < par...nRect.right())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1749 {-
1750 pos.rx() = parentActionRect.left() - menuSize.width();-
1751 if (pos.x() < screen.x()
pos.x() < screen.x()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1752 pos.rx() = parentActionRect.right();
never executed: pos.rx() = parentActionRect.right();
0
1753 if (pos.x() + menuSize.width() > screen.x() + screen.width()
pos.x() + menu...screen.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1754 pos.rx() = screen.x();
never executed: pos.rx() = screen.x();
0
1755 }
never executed: end of block
0
1756 }
never executed: end of block
else {
0
1757 if ((
(pos.x() < par...subMenuOffset)Description
TRUEnever evaluated
FALSEnever evaluated
pos.x() < parentActionRect.right() + subMenuOffset)
(pos.x() < par...subMenuOffset)Description
TRUEnever evaluated
FALSEnever evaluated
0
1758 && (
(pos.x() + men...onRect.left())Description
TRUEnever evaluated
FALSEnever evaluated
pos.x() + menuSize.width() > parentActionRect.left())
(pos.x() + men...onRect.left())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1759 {-
1760 pos.rx() = parentActionRect.right();-
1761 if (pos.x() + menuSize.width() > screen.x() + screen.width()
pos.x() + menu...screen.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1762 pos.rx() = parentActionRect.left() - menuSize.width();
never executed: pos.rx() = parentActionRect.left() - menuSize.width();
0
1763 if (pos.x() < screen.x()
pos.x() < screen.x()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1764 pos.rx() = screen.x() + screen.width() - menuSize.width();
never executed: pos.rx() = screen.x() + screen.width() - menuSize.width();
0
1765 }
never executed: end of block
0
1766 }
never executed: end of block
0
1767 }-
1768 setGeometry(QRect(pos, size));-
1769-
1770 int hGuess = isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
? QEffects::LeftScroll : QEffects::RightScroll;
0
1771 int vGuess = QEffects::DownScroll;-
1772 if (isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1773 if ((snapToMouse
snapToMouseDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(pos.x() + siz...2 > mouse.x())Description
TRUEnever evaluated
FALSEnever evaluated
pos.x() + size.width() / 2 > mouse.x())
(pos.x() + siz...2 > mouse.x())Description
TRUEnever evaluated
FALSEnever evaluated
) ||
0
1774 (qobject_cast<QMenu*>(d->causedPopup.widget)
qobject_cast<Q...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
&& pos.x() + size.width() / 2 > d->causedPopup.widget->x()
pos.x() + size...up.widget->x()Description
TRUEnever evaluated
FALSEnever evaluated
))
0
1775 hGuess = QEffects::RightScroll;
never executed: hGuess = QEffects::RightScroll;
0
1776 }
never executed: end of block
else {
0
1777 if ((snapToMouse
snapToMouseDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(pos.x() + siz...2 < mouse.x())Description
TRUEnever evaluated
FALSEnever evaluated
pos.x() + size.width() / 2 < mouse.x())
(pos.x() + siz...2 < mouse.x())Description
TRUEnever evaluated
FALSEnever evaluated
) ||
0
1778 (qobject_cast<QMenu*>(d->causedPopup.widget)
qobject_cast<Q...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
&& pos.x() + size.width() / 2 < d->causedPopup.widget->x()
pos.x() + size...up.widget->x()Description
TRUEnever evaluated
FALSEnever evaluated
))
0
1779 hGuess = QEffects::LeftScroll;
never executed: hGuess = QEffects::LeftScroll;
0
1780 }
never executed: end of block
0
1781-
1782-
1783 if ((snapToMouse
snapToMouseDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(pos.y() + siz...2 < mouse.y())Description
TRUEnever evaluated
FALSEnever evaluated
pos.y() + size.height() / 2 < mouse.y())
(pos.y() + siz...2 < mouse.y())Description
TRUEnever evaluated
FALSEnever evaluated
) ||
0
1784 (qobject_cast<QMenuBar*>(d->causedPopup.widget)
qobject_cast<Q...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1785 pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y()
pos.y() + size...et->pos()).y()Description
TRUEnever evaluated
FALSEnever evaluated
))
0
1786 vGuess = QEffects::UpScroll;
never executed: vGuess = QEffects::UpScroll;
0
1787-
1788 if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)
QApplication::...I_AnimateMenu)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1789 bool doChildEffects = true;-
1790-
1791 if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)
QMenuBar *mb =...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1792 doChildEffects = mb->d_func()->doChildEffects;-
1793 mb->d_func()->doChildEffects = false;-
1794 }
never executed: end of block
else
0
1795-
1796 if (QMenu *m = qobject_cast<QMenu*>(d->causedPopup.widget)
QMenu *m = qob...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1797 doChildEffects = m->d_func()->doChildEffects;-
1798 m->d_func()->doChildEffects = false;-
1799 }
never executed: end of block
0
1800-
1801 if (doChildEffects
doChildEffectsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1802 if (QApplication::isEffectEnabled(Qt::UI_FadeMenu)
QApplication::...::UI_FadeMenu)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1803 qFadeEffect(this);
never executed: qFadeEffect(this);
0
1804 else if (d->causedPopup.widget
d->causedPopup.widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1805 qScrollEffect(this, qobject_cast<QMenu*>(d->causedPopup.widget) ? hGuess : vGuess);
never executed: qScrollEffect(this, qobject_cast<QMenu*>(d->causedPopup.widget) ? hGuess : vGuess);
0
1806 else-
1807 qScrollEffect(this, hGuess | vGuess);
never executed: qScrollEffect(this, hGuess | vGuess);
0
1808 } else {-
1809-
1810 qFadeEffect(0);-
1811 qScrollEffect(0);-
1812-
1813 show();-
1814 }
never executed: end of block
0
1815 } else-
1816-
1817 {-
1818 show();-
1819 }
never executed: end of block
0
1820-
1821-
1822 QAccessibleEvent event(this, QAccessible::PopupMenuStart);-
1823 QAccessible::updateAccessibility(&event);-
1824-
1825}
never executed: end of block
0
1826QAction *QMenu::exec()-
1827{-
1828 return
never executed: return exec(pos());
exec(pos());
never executed: return exec(pos());
0
1829}-
1830QAction *QMenu::exec(const QPoint &p, QAction *action)-
1831{-
1832 QMenuPrivate * const d = d_func();-
1833 ensurePolished();-
1834 createWinId();-
1835 QEventLoop eventLoop;-
1836 d->eventLoop = &eventLoop;-
1837 popup(p, action);-
1838-
1839 QPointer<QObject> guard = this;-
1840 (void) eventLoop.exec();-
1841 if (guard.isNull()
guard.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1842 return
never executed: return 0;
0;
never executed: return 0;
0
1843-
1844 action = d->syncAction;-
1845 d->syncAction = 0;-
1846 d->eventLoop = 0;-
1847 return
never executed: return action;
action;
never executed: return action;
0
1848}-
1849QAction *QMenu::exec(QList<QAction*> actions, const QPoint &pos, QAction *at, QWidget *parent)-
1850-
1851{-
1852 QMenu menu(parent);-
1853 menu.addActions(actions);-
1854 return
never executed: return menu.exec(pos, at);
menu.exec(pos, at);
never executed: return menu.exec(pos, at);
0
1855}-
1856-
1857-
1858-
1859-
1860void QMenu::hideEvent(QHideEvent *)-
1861{-
1862 QMenuPrivate * const d = d_func();-
1863 aboutToHide();-
1864 if (d->eventLoop
d->eventLoopDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1865 d->eventLoop->exit();
never executed: d->eventLoop->exit();
0
1866 d->setCurrentAction(0);-
1867-
1868 QAccessibleEvent event(this, QAccessible::PopupMenuEnd);-
1869 QAccessible::updateAccessibility(&event);-
1870-
1871-
1872 if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)
QMenuBar *mb =...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1873 mb->d_func()->setCurrentAction(0);
never executed: mb->d_func()->setCurrentAction(0);
0
1874-
1875 d->mouseDown = 0;-
1876 d->hasHadMouse = false;-
1877 if (d->activeMenu
d->activeMenuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1878 d->hideMenu(d->activeMenu);
never executed: d->hideMenu(d->activeMenu);
0
1879 d->causedPopup.widget = 0;-
1880 d->causedPopup.action = 0;-
1881 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1882 d->scroll->scrollTimer.stop();
never executed: d->scroll->scrollTimer.stop();
0
1883}
never executed: end of block
0
1884-
1885-
1886-
1887-
1888void QMenu::paintEvent(QPaintEvent *e)-
1889{-
1890 QMenuPrivate * const d = d_func();-
1891 d->updateActionRects();-
1892 QPainter p(this);-
1893 QRegion emptyArea = QRegion(rect());-
1894-
1895 QStyleOptionMenuItem menuOpt;-
1896 menuOpt.initFrom(this);-
1897 menuOpt.state = QStyle::State_None;-
1898 menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;-
1899 menuOpt.maxIconWidth = 0;-
1900 menuOpt.tabWidth = 0;-
1901 style()->drawPrimitive(QStyle::PE_PanelMenu, &menuOpt, &p, this);-
1902-
1903-
1904 for (int i = 0; i < d->actions.count()
i < d->actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1905 QAction *action = d->actions.at(i);-
1906 QRect adjustedActionRect = d->actionRects.at(i);-
1907 if (!e->rect().intersects(adjustedActionRect)
!e->rect().int...tedActionRect)Description
TRUEnever evaluated
FALSEnever evaluated
0
1908 || d->widgetItems.value(action)
d->widgetItems.value(action)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1909 continue;
never executed: continue;
0
1910-
1911 QRegion adjustedActionReg(adjustedActionRect);-
1912 emptyArea -= adjustedActionReg;-
1913 p.setClipRegion(adjustedActionReg);-
1914-
1915 QStyleOptionMenuItem opt;-
1916 initStyleOption(&opt, action);-
1917 opt.rect = adjustedActionRect;-
1918 style()->drawControl(QStyle::CE_MenuItem, &opt, &p, this);-
1919 }
never executed: end of block
0
1920-
1921 const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);-
1922-
1923 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1924 menuOpt.menuItemType = QStyleOptionMenuItem::Scroller;-
1925 menuOpt.state |= QStyle::State_Enabled;-
1926 if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp
d->scroll->scr...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1927 menuOpt.rect.setRect(fw, fw, width() - (fw * 2), d->scrollerHeight());-
1928 emptyArea -= QRegion(menuOpt.rect);-
1929 p.setClipRect(menuOpt.rect);-
1930 style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p, this);-
1931 }
never executed: end of block
0
1932 if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown
d->scroll->scr...er::ScrollDownDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1933 menuOpt.rect.setRect(fw, height() - d->scrollerHeight() - fw, width() - (fw * 2),-
1934 d->scrollerHeight());-
1935 emptyArea -= QRegion(menuOpt.rect);-
1936 menuOpt.state |= QStyle::State_DownArrow;-
1937 p.setClipRect(menuOpt.rect);-
1938 style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p, this);-
1939 }
never executed: end of block
0
1940 }
never executed: end of block
0
1941-
1942 if (d->tearoff
d->tearoffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1943 menuOpt.menuItemType = QStyleOptionMenuItem::TearOff;-
1944 menuOpt.rect.setRect(fw, fw, width() - (fw * 2),-
1945 style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this));-
1946 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp
d->scroll->scr...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1947 menuOpt.rect.translate(0, d->scrollerHeight());
never executed: menuOpt.rect.translate(0, d->scrollerHeight());
0
1948 emptyArea -= QRegion(menuOpt.rect);-
1949 p.setClipRect(menuOpt.rect);-
1950 menuOpt.state = QStyle::State_None;-
1951 if (d->tearoffHighlighted
d->tearoffHighlightedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1952 menuOpt.state |= QStyle::State_Selected;
never executed: menuOpt.state |= QStyle::State_Selected;
0
1953 style()->drawControl(QStyle::CE_MenuTearoff, &menuOpt, &p, this);-
1954 }
never executed: end of block
0
1955-
1956 if (fw
fwDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1957 QRegion borderReg;-
1958 borderReg += QRect(0, 0, fw, height());-
1959 borderReg += QRect(width()-fw, 0, fw, height());-
1960 borderReg += QRect(0, 0, width(), fw);-
1961 borderReg += QRect(0, height()-fw, width(), fw);-
1962 p.setClipRegion(borderReg);-
1963 emptyArea -= borderReg;-
1964 QStyleOptionFrame frame;-
1965 frame.rect = rect();-
1966 frame.palette = palette();-
1967 frame.state = QStyle::State_None;-
1968 frame.lineWidth = style()->pixelMetric(QStyle::PM_MenuPanelWidth);-
1969 frame.midLineWidth = 0;-
1970 style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, &p, this);-
1971 }
never executed: end of block
0
1972-
1973-
1974 p.setClipRegion(emptyArea);-
1975 menuOpt.state = QStyle::State_None;-
1976 menuOpt.menuItemType = QStyleOptionMenuItem::EmptyArea;-
1977 menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;-
1978 menuOpt.rect = rect();-
1979 menuOpt.menuRect = rect();-
1980 style()->drawControl(QStyle::CE_MenuEmptyArea, &menuOpt, &p, this);-
1981}
never executed: end of block
0
1982-
1983-
1984-
1985-
1986-
1987void QMenu::wheelEvent(QWheelEvent *e)-
1988{-
1989 QMenuPrivate * const d = d_func();-
1990 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& rect().contains(e->pos())
rect().contains(e->pos())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1991 d->scrollMenu(e->delta() > 0 ?
never executed: d->scrollMenu(e->delta() > 0 ? QMenuPrivate::QMenuScroller::ScrollUp : QMenuPrivate::QMenuScroller::ScrollDown);
0
1992 QMenuPrivate::QMenuScroller::ScrollUp : QMenuPrivate::QMenuScroller::ScrollDown);
never executed: d->scrollMenu(e->delta() > 0 ? QMenuPrivate::QMenuScroller::ScrollUp : QMenuPrivate::QMenuScroller::ScrollDown);
0
1993}
never executed: end of block
0
1994-
1995-
1996-
1997-
1998-
1999void QMenu::mousePressEvent(QMouseEvent *e)-
2000{-
2001 QMenuPrivate * const d = d_func();-
2002 if (d->aboutToHide
d->aboutToHideDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->mouseEventTaken(e)
d->mouseEventTaken(e)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2003 return;
never executed: return;
0
2004-
2005-
2006-
2007-
2008 if ((e->pos().isNull()
e->pos().isNull()Description
TRUEnever evaluated
FALSEnever evaluated
&& !e->screenPos().isNull()
!e->screenPos().isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) || !rect().contains(e->pos())
!rect().contains(e->pos())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2009 if (d->noReplayFor
d->noReplayForDescription
TRUEnever evaluated
FALSEnever evaluated
0
2010 && QRect(d->noReplayFor->mapToGlobal(QPoint()), d->noReplayFor->size()).contains(e->globalPos())
QRect(d->noRep...->globalPos())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2011 setAttribute(Qt::WA_NoMouseReplay);
never executed: setAttribute(Qt::WA_NoMouseReplay);
0
2012 if (d->eventLoop
d->eventLoopDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2013 d->syncAction = 0;
never executed: d->syncAction = 0;
0
2014 d->hideUpToMenuBar();-
2015 return;
never executed: return;
0
2016 }-
2017 d->mouseDown = this;-
2018-
2019 QAction *action = d->actionAt(e->pos());-
2020 d->setCurrentAction(action, 20);-
2021 update();-
2022}
never executed: end of block
0
2023-
2024-
2025-
2026-
2027void QMenu::mouseReleaseEvent(QMouseEvent *e)-
2028{-
2029 QMenuPrivate * const d = d_func();-
2030 if (d->aboutToHide
d->aboutToHideDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->mouseEventTaken(e)
d->mouseEventTaken(e)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2031 return;
never executed: return;
0
2032 if(d->mouseDown != this
d->mouseDown != thisDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2033 d->mouseDown = 0;-
2034 return;
never executed: return;
0
2035 }-
2036-
2037 d->mouseDown = 0;-
2038 d->setSyncAction();-
2039 QAction *action = d->actionAt(e->pos());-
2040-
2041 if (action
actionDescription
TRUEnever evaluated
FALSEnever evaluated
&& action == d->currentAction
action == d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2042 if (!action->menu()
!action->menu()Description
TRUEnever evaluated
FALSEnever evaluated
){
0
2043-
2044-
2045-
2046-
2047 d->activateAction(action, QAction::Trigger);-
2048 }
never executed: end of block
0
2049 }
never executed: end of block
else if ((!action
!actionDescription
TRUEnever evaluated
FALSEnever evaluated
|| action->isEnabled()
action->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) && d->hasMouseMoved(e->globalPos())
d->hasMouseMov...->globalPos())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2050 d->hideUpToMenuBar();-
2051 }
never executed: end of block
0
2052}
never executed: end of block
0
2053-
2054-
2055-
2056-
2057void QMenu::changeEvent(QEvent *e)-
2058{-
2059 QMenuPrivate * const d = d_func();-
2060 if (e->type() == QEvent::StyleChange
e->type() == Q...t::StyleChangeDescription
TRUEnever evaluated
FALSEnever evaluated
|| e->type() == QEvent::FontChange
e->type() == Q...nt::FontChangeDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
2061 e->type() == QEvent::LayoutDirectionChange
e->type() == Q...irectionChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2062 d->itemsDirty = 1;-
2063 setMouseTracking(style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, this));-
2064 if (isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2065 resize(sizeHint());
never executed: resize(sizeHint());
0
2066 if (!style()->styleHint(QStyle::SH_Menu_Scrollable, 0, this)
!style()->styl...able, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2067 delete d->scroll;-
2068 d->scroll = 0;-
2069 }
never executed: end of block
else if (!d->scroll
!d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2070 d->scroll = new QMenuPrivate::QMenuScroller;-
2071 d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;-
2072 }
never executed: end of block
0
2073 }
never executed: end of block
else if (e->type() == QEvent::EnabledChange
e->type() == Q...:EnabledChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2074 if (d->tornPopup
d->tornPopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2075 d->tornPopup->setEnabled(isEnabled());
never executed: d->tornPopup->setEnabled(isEnabled());
0
2076 d->menuAction->setEnabled(isEnabled());-
2077 if (!d->platformMenu.isNull()
!d->platformMenu.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2078 d->platformMenu->setEnabled(isEnabled());
never executed: d->platformMenu->setEnabled(isEnabled());
0
2079 }
never executed: end of block
0
2080 QWidget::changeEvent(e);-
2081}
never executed: end of block
0
2082-
2083-
2084-
2085-
2086-
2087bool-
2088QMenu::event(QEvent *e)-
2089{-
2090 QMenuPrivate * const d = d_func();-
2091 switch (e->type()) {-
2092 case
never executed: case QEvent::Polish:
QEvent::Polish:
never executed: case QEvent::Polish:
0
2093 d->updateLayoutDirection();-
2094 break;
never executed: break;
0
2095 case
never executed: case QEvent::ShortcutOverride:
QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
{
0
2096 QKeyEvent *kev = static_cast<QKeyEvent*>(e);-
2097 if (kev->key() == Qt::Key_Up
kev->key() == Qt::Key_UpDescription
TRUEnever evaluated
FALSEnever evaluated
|| kev->key() == Qt::Key_Down
kev->key() == Qt::Key_DownDescription
TRUEnever evaluated
FALSEnever evaluated
0
2098 || kev->key() == Qt::Key_Left
kev->key() == Qt::Key_LeftDescription
TRUEnever evaluated
FALSEnever evaluated
|| kev->key() == Qt::Key_Right
kev->key() == Qt::Key_RightDescription
TRUEnever evaluated
FALSEnever evaluated
0
2099 || kev->key() == Qt::Key_Enter
kev->key() == Qt::Key_EnterDescription
TRUEnever evaluated
FALSEnever evaluated
|| kev->key() == Qt::Key_Return
kev->key() == Qt::Key_ReturnDescription
TRUEnever evaluated
FALSEnever evaluated
0
2100 || kev->matches(QKeySequence::Cancel)
kev->matches(Q...uence::Cancel)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2101 e->accept();-
2102 return
never executed: return true;
true;
never executed: return true;
0
2103 }-
2104 }-
2105 break;
never executed: break;
0
2106 case
never executed: case QEvent::KeyPress:
QEvent::KeyPress:
never executed: case QEvent::KeyPress:
{
0
2107 QKeyEvent *ke = (QKeyEvent*)e;-
2108 if (ke->key() == Qt::Key_Tab
ke->key() == Qt::Key_TabDescription
TRUEnever evaluated
FALSEnever evaluated
|| ke->key() == Qt::Key_Backtab
ke->key() == Qt::Key_BacktabDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2109 keyPressEvent(ke);-
2110 return
never executed: return true;
true;
never executed: return true;
0
2111 }-
2112 } break;
never executed: break;
0
2113 case
never executed: case QEvent::MouseButtonPress:
QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
2114 case
never executed: case QEvent::ContextMenu:
QEvent::ContextMenu:
never executed: case QEvent::ContextMenu:
{
0
2115 bool canPopup = true;-
2116 if (e->type() == QEvent::MouseButtonPress
e->type() == Q...useButtonPressDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2117 canPopup = (static_cast<QMouseEvent*>(e)->button() == Qt::LeftButton);
never executed: canPopup = (static_cast<QMouseEvent*>(e)->button() == Qt::LeftButton);
0
2118 if (canPopup
canPopupDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->delayState.timer.isActive()
d->delayState.timer.isActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2119 d->delayState.stop();-
2120 internalDelayedPopup();-
2121 }
never executed: end of block
0
2122 }-
2123 break;
never executed: break;
0
2124 case
never executed: case QEvent::Resize:
QEvent::Resize:
never executed: case QEvent::Resize:
{
0
2125 QStyleHintReturnMask menuMask;-
2126 QStyleOption option;-
2127 option.initFrom(this);-
2128 if (style()->styleHint(QStyle::SH_Menu_Mask, &option, this, &menuMask)
style()->style...is, &menuMask)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2129 setMask(menuMask.region);-
2130 }
never executed: end of block
0
2131 d->itemsDirty = 1;-
2132 d->updateActionRects();-
2133 break;
never executed: break;
}
0
2134 case
never executed: case QEvent::Show:
QEvent::Show:
never executed: case QEvent::Show:
0
2135 d->mouseDown = 0;-
2136 d->updateActionRects();-
2137 d->sloppyState.reset();-
2138 if (d->currentAction
d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2139 d->popupAction(d->currentAction, 0, false);
never executed: d->popupAction(d->currentAction, 0, false);
0
2140 break;
never executed: break;
0
2141-
2142 case
never executed: case QEvent::ToolTip:
QEvent::ToolTip:
never executed: case QEvent::ToolTip:
0
2143 if (d->toolTipsVisible
d->toolTipsVisibleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2144 const QHelpEvent *ev = static_cast<const QHelpEvent*>(e);-
2145 if (const
const QAction ...nAt(ev->pos())Description
TRUEnever evaluated
FALSEnever evaluated
QAction *action = actionAt(ev->pos())
const QAction ...nAt(ev->pos())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2146 const QString toolTip = action->d_func()->tooltip;-
2147 if (!toolTip.isEmpty()
!toolTip.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2148 QToolTip::showText(ev->globalPos(), toolTip, this);
never executed: QToolTip::showText(ev->globalPos(), toolTip, this);
0
2149 return
never executed: return true;
true;
never executed: return true;
0
2150 }-
2151 }
never executed: end of block
0
2152 break;
never executed: break;
0
2153-
2154-
2155 case
never executed: case QEvent::QueryWhatsThis:
QEvent::QueryWhatsThis:
never executed: case QEvent::QueryWhatsThis:
0
2156 e->setAccepted(d->whatsThis.size());-
2157 if (QAction *action = d->actionAt(static_cast<QHelpEvent*>(e)->pos())
QAction *actio...t*>(e)->pos())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2158 if (action->whatsThis().size()
action->whatsThis().size()Description
TRUEnever evaluated
FALSEnever evaluated
|| action->menu()
action->menu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2159 e->accept();
never executed: e->accept();
0
2160 }
never executed: end of block
0
2161 return
never executed: return true;
true;
never executed: return true;
0
2162-
2163 default
never executed: default:
:
never executed: default:
0
2164 break;
never executed: break;
0
2165 }-
2166 return
never executed: return QWidget::event(e);
QWidget::event(e);
never executed: return QWidget::event(e);
0
2167}-
2168-
2169-
2170-
2171-
2172bool QMenu::focusNextPrevChild(bool next)-
2173{-
2174 setFocus();-
2175 QKeyEvent ev(QEvent::KeyPress, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier);-
2176 keyPressEvent(&ev);-
2177 return
never executed: return true;
true;
never executed: return true;
0
2178}-
2179-
2180-
2181-
2182-
2183void QMenu::keyPressEvent(QKeyEvent *e)-
2184{-
2185 QMenuPrivate * const d = d_func();-
2186 d->updateActionRects();-
2187 int key = e->key();-
2188 if (isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2189 if (key == Qt::Key_Left
key == Qt::Key_LeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2190 key = Qt::Key_Right;
never executed: key = Qt::Key_Right;
0
2191 else if (key == Qt::Key_Right
key == Qt::Key_RightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2192 key = Qt::Key_Left;
never executed: key = Qt::Key_Left;
0
2193 }
never executed: end of block
0
2194-
2195 if (key == Qt::Key_Tab
key == Qt::Key_TabDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2196 key = Qt::Key_Down;
never executed: key = Qt::Key_Down;
0
2197 if (key == Qt::Key_Backtab
key == Qt::Key_BacktabDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2198 key = Qt::Key_Up;
never executed: key = Qt::Key_Up;
0
2199-
2200-
2201 bool key_consumed = false;-
2202 switch(key) {-
2203 case
never executed: case Qt::Key_Home:
Qt::Key_Home:
never executed: case Qt::Key_Home:
0
2204 key_consumed = true;-
2205 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2206 d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollTop, true);
never executed: d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollTop, true);
0
2207 break;
never executed: break;
0
2208 case
never executed: case Qt::Key_End:
Qt::Key_End:
never executed: case Qt::Key_End:
0
2209 key_consumed = true;-
2210 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2211 d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollBottom, true);
never executed: d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollBottom, true);
0
2212 break;
never executed: break;
0
2213 case
never executed: case Qt::Key_PageUp:
Qt::Key_PageUp:
never executed: case Qt::Key_PageUp:
0
2214 key_consumed = true;-
2215 if (d->currentAction
d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2216 if(d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp
d->scroll->scr...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2217 d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollUp, true, true);
never executed: d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollUp, true, true);
0
2218 else-
2219 d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollTop, true);
never executed: d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollTop, true);
0
2220 }-
2221 break;
never executed: break;
0
2222 case
never executed: case Qt::Key_PageDown:
Qt::Key_PageDown:
never executed: case Qt::Key_PageDown:
0
2223 key_consumed = true;-
2224 if (d->currentAction
d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2225 if(d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown
d->scroll->scr...er::ScrollDownDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2226 d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollDown, true, true);
never executed: d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollDown, true, true);
0
2227 else-
2228 d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollBottom, true);
never executed: d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollBottom, true);
0
2229 }-
2230 break;
never executed: break;
0
2231 case
never executed: case Qt::Key_Up:
Qt::Key_Up:
never executed: case Qt::Key_Up:
0
2232 case
never executed: case Qt::Key_Down:
Qt::Key_Down:
never executed: case Qt::Key_Down:
{
0
2233 key_consumed = true;-
2234 QAction *nextAction = 0;-
2235 QMenuPrivate::QMenuScroller::ScrollLocation scroll_loc = QMenuPrivate::QMenuScroller::ScrollStay;-
2236 if (!d->currentAction
!d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2237 if(key == Qt::Key_Down
key == Qt::Key_DownDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2238 for(int i = 0; i < d->actions.count()
i < d->actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
2239 QAction *act = d->actions.at(i);-
2240 if (d->actionRects.at(i).isNull()
d->actionRects.at(i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2241 continue;
never executed: continue;
0
2242 if (!act->isSeparator()
!act->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
2243 (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this)
style()->style...bled, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
0
2244 || act->isEnabled()
act->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
2245 nextAction = act;-
2246 break;
never executed: break;
0
2247 }-
2248 }
never executed: end of block
0
2249 }
never executed: end of block
else {
0
2250 for(int i = d->actions.count()-1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
2251 QAction *act = d->actions.at(i);-
2252 if (d->actionRects.at(i).isNull()
d->actionRects.at(i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2253 continue;
never executed: continue;
0
2254 if (!act->isSeparator()
!act->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
2255 (style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this)
style()->style...bled, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
0
2256 || act->isEnabled()
act->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
2257 nextAction = act;-
2258 break;
never executed: break;
0
2259 }-
2260 }
never executed: end of block
0
2261 }
never executed: end of block
0
2262 } else {-
2263 for(int i = 0, y = 0; !nextAction
!nextActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& i < d->actions.count()
i < d->actions.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
2264 QAction *act = d->actions.at(i);-
2265 if (act == d->currentAction
act == d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2266 if (key == Qt::Key_Up
key == Qt::Key_UpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2267 for(int next_i = i-1; true
trueDescription
TRUEnever evaluated
FALSEnever evaluated
; next_i--) {
0
2268 if (next_i == -1
next_i == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2269 if(!style()->styleHint(QStyle::SH_Menu_SelectionWrap, 0, this)
!style()->styl...Wrap, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2270 break;
never executed: break;
0
2271 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2272 scroll_loc = QMenuPrivate::QMenuScroller::ScrollBottom;
never executed: scroll_loc = QMenuPrivate::QMenuScroller::ScrollBottom;
0
2273 next_i = d->actionRects.count()-1;-
2274 }
never executed: end of block
0
2275 QAction *next = d->actions.at(next_i);-
2276 if (next == d->currentAction
next == d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2277 break;
never executed: break;
0
2278 if (d->actionRects.at(next_i).isNull()
d->actionRects...xt_i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2279 continue;
never executed: continue;
0
2280 if (next->isSeparator()
next->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
2281 (!next->isEnabled()
!next->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
2282 !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this)
!style()->styl...bled, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
))
0
2283 continue;
never executed: continue;
0
2284 nextAction = next;-
2285 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(d->scroll->sc...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
(d->scroll->sc...ler::ScrollUp)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2286 int topVisible = d->scrollerHeight();-
2287 if (d->tearoff
d->tearoffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2288 topVisible += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this);
never executed: topVisible += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this);
0
2289 if (((
((y + d->scrol...xt_i).height()Description
TRUEnever evaluated
FALSEnever evaluated
y + d->scroll->scrollOffset) - topVisible) <= d->actionRects.at(next_i).height()
((y + d->scrol...xt_i).height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2290 scroll_loc = QMenuPrivate::QMenuScroller::ScrollTop;
never executed: scroll_loc = QMenuPrivate::QMenuScroller::ScrollTop;
0
2291 }
never executed: end of block
0
2292 break;
never executed: break;
0
2293 }-
2294 if (!nextAction
!nextActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->tearoff
d->tearoffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2295 d->tearoffHighlighted = 1;
never executed: d->tearoffHighlighted = 1;
0
2296 }
never executed: end of block
else {
0
2297 y += d->actionRects.at(i).height();-
2298 for(int next_i = i+1; true
trueDescription
TRUEnever evaluated
FALSEnever evaluated
; next_i++) {
0
2299 if (next_i == d->actionRects.count()
next_i == d->a...nRects.count()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2300 if(!style()->styleHint(QStyle::SH_Menu_SelectionWrap, 0, this)
!style()->styl...Wrap, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2301 break;
never executed: break;
0
2302 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2303 scroll_loc = QMenuPrivate::QMenuScroller::ScrollTop;
never executed: scroll_loc = QMenuPrivate::QMenuScroller::ScrollTop;
0
2304 next_i = 0;-
2305 }
never executed: end of block
0
2306 QAction *next = d->actions.at(next_i);-
2307 if (next == d->currentAction
next == d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2308 break;
never executed: break;
0
2309 if (d->actionRects.at(next_i).isNull()
d->actionRects...xt_i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2310 continue;
never executed: continue;
0
2311 if (next->isSeparator()
next->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
2312 (!next->isEnabled()
!next->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
2313 !style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, this)
!style()->styl...bled, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
))
0
2314 continue;
never executed: continue;
0
2315 nextAction = next;-
2316 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(d->scroll->sc...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown)
(d->scroll->sc...r::ScrollDown)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2317 int bottomVisible = height() - d->scrollerHeight();-
2318 if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp
d->scroll->scr...ller::ScrollUpDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2319 bottomVisible -= d->scrollerHeight();
never executed: bottomVisible -= d->scrollerHeight();
0
2320 if (d->tearoff
d->tearoffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2321 bottomVisible -= style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this);
never executed: bottomVisible -= style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this);
0
2322 if ((
(y + d->scroll... bottomVisibleDescription
TRUEnever evaluated
FALSEnever evaluated
y + d->scroll->scrollOffset + d->actionRects.at(next_i).height()) > bottomVisible
(y + d->scroll... bottomVisibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2323 scroll_loc = QMenuPrivate::QMenuScroller::ScrollBottom;
never executed: scroll_loc = QMenuPrivate::QMenuScroller::ScrollBottom;
0
2324 }
never executed: end of block
0
2325 break;
never executed: break;
0
2326 }-
2327 }
never executed: end of block
0
2328 break;
never executed: break;
0
2329 }-
2330 y += d->actionRects.at(i).height();-
2331 }
never executed: end of block
0
2332 }
never executed: end of block
0
2333 if (nextAction
nextActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2334 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& scroll_loc != QMenuPrivate::QMenuScroller::ScrollStay
scroll_loc != ...er::ScrollStayDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2335 d->scroll->scrollTimer.stop();-
2336 d->scrollMenu(nextAction, scroll_loc);-
2337 }
never executed: end of block
0
2338 d->setCurrentAction(nextAction, -1, QMenuPrivate::SelectedFromKeyboard);-
2339 }
never executed: end of block
0
2340 break;
never executed: break;
}
0
2341-
2342 case
never executed: case Qt::Key_Right:
Qt::Key_Right:
never executed: case Qt::Key_Right:
0
2343 if (d->currentAction
d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->currentAction->isEnabled()
d->currentAction->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->currentAction->menu()
d->currentAction->menu()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2344 d->popupAction(d->currentAction, 0, true);-
2345 key_consumed = true;-
2346 break;
never executed: break;
0
2347 }-
2348-
2349 case
never executed: case Qt::Key_Left:
Qt::Key_Left:
never executed: case Qt::Key_Left:
code before this statement never executed: case Qt::Key_Left:
{
0
2350 if (d->currentAction
d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->scroll
!d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2351 QAction *nextAction = 0;-
2352 if (key == Qt::Key_Left
key == Qt::Key_LeftDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2353 QRect actionR = d->actionRect(d->currentAction);-
2354 for(int x = actionR.left()-1; !nextAction
!nextActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& x >= 0
x >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; x--)
0
2355 nextAction = d->actionAt(QPoint(x, actionR.center().y()));
never executed: nextAction = d->actionAt(QPoint(x, actionR.center().y()));
0
2356 }
never executed: end of block
else {
0
2357 QRect actionR = d->actionRect(d->currentAction);-
2358 for(int x = actionR.right()+1; !nextAction
!nextActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& x < width()
x < width()Description
TRUEnever evaluated
FALSEnever evaluated
; x++)
0
2359 nextAction = d->actionAt(QPoint(x, actionR.center().y()));
never executed: nextAction = d->actionAt(QPoint(x, actionR.center().y()));
0
2360 }
never executed: end of block
0
2361 if (nextAction
nextActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2362 d->setCurrentAction(nextAction, -1, QMenuPrivate::SelectedFromKeyboard);-
2363 key_consumed = true;-
2364 }
never executed: end of block
0
2365 }
never executed: end of block
0
2366 if (!key_consumed
!key_consumedDescription
TRUEnever evaluated
FALSEnever evaluated
&& key == Qt::Key_Left
key == Qt::Key_LeftDescription
TRUEnever evaluated
FALSEnever evaluated
&& qobject_cast<QMenu*>(d->causedPopup.widget)
qobject_cast<Q...dPopup.widget)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2367 QPointer<QWidget> caused = d->causedPopup.widget;-
2368 d->hideMenu(this);-
2369 if (caused
causedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2370 caused->setFocus();
never executed: caused->setFocus();
0
2371 key_consumed = true;-
2372 }
never executed: end of block
0
2373 break;
never executed: break;
}
0
2374-
2375 case
never executed: case Qt::Key_Alt:
Qt::Key_Alt:
never executed: case Qt::Key_Alt:
0
2376 if (d->tornoff
d->tornoffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2377 break;
never executed: break;
0
2378-
2379 key_consumed = true;-
2380 if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)
style()->style...tion, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2381 {-
2382 d->hideMenu(this);-
2383-
2384 if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())
QMenuBar *mb =...focusWidget())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2385 mb->d_func()->setKeyboardMode(false);-
2386 }
never executed: end of block
0
2387-
2388 }
never executed: end of block
0
2389 break;
never executed: break;
0
2390-
2391 case
never executed: case Qt::Key_Space:
Qt::Key_Space:
never executed: case Qt::Key_Space:
0
2392 if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this)
!style()->styl...Item, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2393 break;
never executed: break;
0
2394-
2395-
2396-
2397-
2398 case
never executed: case Qt::Key_Return:
Qt::Key_Return:
never executed: case Qt::Key_Return:
code before this statement never executed: case Qt::Key_Return:
0
2399 case
never executed: case Qt::Key_Enter:
Qt::Key_Enter:
never executed: case Qt::Key_Enter:
{
0
2400 if (!d->currentAction
!d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2401 d->setFirstActionActive();-
2402 key_consumed = true;-
2403 break;
never executed: break;
0
2404 }-
2405-
2406 d->setSyncAction();-
2407-
2408 if (d->currentAction->menu()
d->currentAction->menu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2409 d->popupAction(d->currentAction, 0, true);
never executed: d->popupAction(d->currentAction, 0, true);
0
2410 else-
2411 d->activateAction(d->currentAction, QAction::Trigger);
never executed: d->activateAction(d->currentAction, QAction::Trigger);
0
2412 key_consumed = true;-
2413 break;
never executed: break;
}
0
2414-
2415-
2416 case
never executed: case Qt::Key_F1:
Qt::Key_F1:
never executed: case Qt::Key_F1:
0
2417 if (!d->currentAction
!d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->currentAction->whatsThis().isNull()
d->currentActi...his().isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2418 break;
never executed: break;
0
2419 QWhatsThis::enterWhatsThisMode();-
2420 d->activateAction(d->currentAction, QAction::Trigger);-
2421 return;
never executed: return;
0
2422-
2423 default
never executed: default:
:
never executed: default:
0
2424 key_consumed = false;-
2425 }
never executed: end of block
0
2426-
2427 if (!key_consumed
!key_consumedDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(e->matches(QK...nce::Cancel) )Description
TRUEnever evaluated
FALSEnever evaluated
e->matches(QKeySequence::Cancel)
(e->matches(QK...nce::Cancel) )Description
TRUEnever evaluated
FALSEnever evaluated
0
24280
24290
24300
2431 )
(e->matches(QK...nce::Cancel) )Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2432 key_consumed = true;-
2433 if (d->tornoff
d->tornoffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2434 close();-
2435 return;
never executed: return;
0
2436 }-
2437 {-
2438 QPointer<QWidget> caused = d->causedPopup.widget;-
2439 d->hideMenu(this);-
2440-
2441 if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)
QMenuBar *mb =...uBar*>(caused)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2442 mb->d_func()->setCurrentAction(d->menuAction);-
2443 mb->d_func()->setKeyboardMode(true);-
2444 }
never executed: end of block
0
2445-
2446 }-
2447 }
never executed: end of block
0
2448-
2449 if (!key_consumed
!key_consumedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2450 if ((!e->modifiers()
!e->modifiers()Description
TRUEnever evaluated
FALSEnever evaluated
|| e->modifiers() == Qt::AltModifier
e->modifiers()...t::AltModifierDescription
TRUEnever evaluated
FALSEnever evaluated
|| e->modifiers() == Qt::ShiftModifier
e->modifiers()...:ShiftModifierDescription
TRUEnever evaluated
FALSEnever evaluated
) &&
0
2451 e->text().length()==1
e->text().length()==1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2452 bool activateAction = false;-
2453 QAction *nextAction = 0;-
2454 if (style()->styleHint(QStyle::SH_Menu_KeyboardSearch, 0, this)
style()->style...arch, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
&& !e->modifiers()
!e->modifiers()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2455 int best_match_count = 0;-
2456 d->searchBufferTimer.start(2000, this);-
2457 d->searchBuffer += e->text();-
2458 for(int i = 0; i < d->actions.size()
i < d->actions.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
2459 int match_count = 0;-
2460 if (d->actionRects.at(i).isNull()
d->actionRects.at(i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2461 continue;
never executed: continue;
0
2462 QAction *act = d->actions.at(i);-
2463 const QString act_text = act->text();-
2464 for(int c = 0; c < d->searchBuffer.size()
c < d->searchBuffer.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++c) {
0
2465 if(act_text.indexOf(d->searchBuffer.at(c), 0, Qt::CaseInsensitive) != -1
act_text.index...nsitive) != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2466 ++
never executed: ++match_count;
match_count;
never executed: ++match_count;
0
2467 }
never executed: end of block
0
2468 if(match_count > best_match_count
match_count > best_match_countDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2469 best_match_count = match_count;-
2470 nextAction = act;-
2471 }
never executed: end of block
0
2472 }
never executed: end of block
0
2473 }
never executed: end of block
0
2474-
2475 else {-
2476 int clashCount = 0;-
2477 QAction *first = 0, *currentSelected = 0, *firstAfterCurrent = 0;-
2478 QChar c = e->text().at(0).toUpper();-
2479 for(int i = 0; i < d->actions.size()
i < d->actions.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
2480 if (d->actionRects.at(i).isNull()
d->actionRects.at(i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2481 continue;
never executed: continue;
0
2482 QAction *act = d->actions.at(i);-
2483 QKeySequence sequence = QKeySequence::mnemonic(act->text());-
2484 int key = sequence[0] & 0xffff;-
2485 if (key == c.unicode()
key == c.unicode()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2486 clashCount++;-
2487 if (!first
!firstDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2488 first = act;
never executed: first = act;
0
2489 if (act == d->currentAction
act == d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2490 currentSelected = act;
never executed: currentSelected = act;
0
2491 else if (!firstAfterCurrent
!firstAfterCurrentDescription
TRUEnever evaluated
FALSEnever evaluated
&& currentSelected
currentSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2492 firstAfterCurrent = act;
never executed: firstAfterCurrent = act;
0
2493 }
never executed: end of block
0
2494 }
never executed: end of block
0
2495 if (clashCount == 1
clashCount == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2496 activateAction = true;
never executed: activateAction = true;
0
2497 if (clashCount >= 1
clashCount >= 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2498 if (clashCount == 1
clashCount == 1Description
TRUEnever evaluated
FALSEnever evaluated
|| !currentSelected
!currentSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
|| !firstAfterCurrent
!firstAfterCurrentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2499 nextAction = first;
never executed: nextAction = first;
0
2500 else-
2501 nextAction = firstAfterCurrent;
never executed: nextAction = firstAfterCurrent;
0
2502 }-
2503 }
never executed: end of block
0
2504-
2505 if (nextAction
nextActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2506 key_consumed = true;-
2507 if(d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2508 d->scrollMenu(nextAction, QMenuPrivate::QMenuScroller::ScrollCenter, false);
never executed: d->scrollMenu(nextAction, QMenuPrivate::QMenuScroller::ScrollCenter, false);
0
2509 d->setCurrentAction(nextAction, 0, QMenuPrivate::SelectedFromElsewhere, true);-
2510 if (!nextAction->menu()
!nextAction->menu()Description
TRUEnever evaluated
FALSEnever evaluated
&& activateAction
activateActionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2511 d->setSyncAction();-
2512 d->activateAction(nextAction, QAction::Trigger);-
2513 }
never executed: end of block
0
2514 }
never executed: end of block
0
2515 }
never executed: end of block
0
2516 if (!key_consumed
!key_consumedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2517-
2518 if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())
QMenuBar *mb =...ausedWidget())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2519 QAction *oldAct = mb->d_func()->currentAction;-
2520 QApplication::sendEvent(mb, e);-
2521 if (mb->d_func()->currentAction != oldAct
mb->d_func()->...tion != oldActDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2522 key_consumed = true;
never executed: key_consumed = true;
0
2523 }
never executed: end of block
0
2524-
2525 }
never executed: end of block
0
2526-
2527-
2528-
2529-
2530-
2531 }
never executed: end of block
0
2532 if (key_consumed
key_consumedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2533 e->accept();
never executed: e->accept();
0
2534 else-
2535 e->ignore();
never executed: e->ignore();
0
2536}-
2537-
2538-
2539-
2540-
2541void QMenu::mouseMoveEvent(QMouseEvent *e)-
2542{-
2543 QMenuPrivate * const d = d_func();-
2544 if (!isVisible()
!isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
|| d->aboutToHide
d->aboutToHideDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->mouseEventTaken(e)
d->mouseEventTaken(e)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2545 return;
never executed: return;
0
2546-
2547 d->motions++;-
2548 if (d->motions == 0
d->motions == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2549 return;
never executed: return;
0
2550-
2551 d->hasHadMouse = d->hasHadMouse
d->hasHadMouseDescription
TRUEnever evaluated
FALSEnever evaluated
|| rect().contains(e->pos())
rect().contains(e->pos())Description
TRUEnever evaluated
FALSEnever evaluated
;
0
2552-
2553 QAction *action = d->actionAt(e->pos());-
2554 if ((!action
!actionDescription
TRUEnever evaluated
FALSEnever evaluated
|| action->isSeparator()
action->isSeparator()Description
TRUEnever evaluated
FALSEnever evaluated
) && !d->sloppyState.enabled()
!d->sloppyState.enabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2555 if (d->hasHadMouse
d->hasHadMouseDescription
TRUEnever evaluated
FALSEnever evaluated
0
2556 || (!d->currentAction
!d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
|| !d->currentAction->menu()
!d->currentAction->menu()Description
TRUEnever evaluated
FALSEnever evaluated
|| !d->currentAction->menu()->isVisible()
!d->currentAct...)->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
2557 d->setCurrentAction(action);-
2558 }
never executed: end of block
0
2559 return;
never executed: return;
0
2560 }-
2561-
2562 if (e->buttons()
e->buttons()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2563 d->mouseDown = this;
never executed: d->mouseDown = this;
0
2564-
2565 if (d->activeMenu
d->activeMenuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2566 d->activeMenu->d_func()->setCurrentAction(0);
never executed: d->activeMenu->d_func()->setCurrentAction(0);
0
2567-
2568 QMenuSloppyState::MouseEventResult sloppyEventResult = d->sloppyState.processMouseEvent(e->localPos(), action, d->currentAction);-
2569 if (sloppyEventResult == QMenuSloppyState::EventShouldBePropagated
sloppyEventRes...ldBePropagatedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2570 d->setCurrentAction(action, d->mousePopupDelay);-
2571 }
never executed: end of block
else if (sloppyEventResult == QMenuSloppyState::EventDiscardsSloppyState
sloppyEventRes...rdsSloppyStateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2572 d->sloppyState.reset();-
2573 d->hideMenu(d->activeMenu);-
2574 }
never executed: end of block
0
2575}
never executed: end of block
0
2576-
2577-
2578-
2579-
2580void QMenu::enterEvent(QEvent *)-
2581{-
2582 QMenuPrivate * const d = d_func();-
2583 d->hasReceievedEnter = true;-
2584 d->sloppyState.enter();-
2585 d->motions = -1;-
2586}
never executed: end of block
0
2587-
2588-
2589-
2590-
2591void QMenu::leaveEvent(QEvent *)-
2592{-
2593 QMenuPrivate * const d = d_func();-
2594 d->hasReceievedEnter = false;-
2595 if (!d->activeMenu
!d->activeMenuDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->currentAction
d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2596 setActiveAction(0);
never executed: setActiveAction(0);
0
2597}
never executed: end of block
0
2598-
2599-
2600-
2601-
2602void-
2603QMenu::timerEvent(QTimerEvent *e)-
2604{-
2605 QMenuPrivate * const d = d_func();-
2606 if (d->scroll
d->scrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->scroll->scrollTimer.timerId() == e->timerId()
d->scroll->scr...= e->timerId()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2607 d->scrollMenu((QMenuPrivate::QMenuScroller::ScrollDirection)d->scroll->scrollDirection);-
2608 if (d->scroll->scrollFlags == QMenuPrivate::QMenuScroller::ScrollNone
d->scroll->scr...er::ScrollNoneDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2609 d->scroll->scrollTimer.stop();
never executed: d->scroll->scrollTimer.stop();
0
2610 }
never executed: end of block
else if (d->delayState.timer.timerId() == e->timerId()
d->delayState....= e->timerId()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2611 if (d->currentAction
d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->currentAction->menu()
!d->currentAction->menu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2612 return;
never executed: return;
0
2613 d->delayState.stop();-
2614 d->sloppyState.stopTimer();-
2615 internalDelayedPopup();-
2616 }
never executed: end of block
else if (d->sloppyState.isTimerId(e->timerId())
d->sloppyState...(e->timerId())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2617 d->sloppyState.timeout();-
2618 }
never executed: end of block
else if(d->searchBufferTimer.timerId() == e->timerId()
d->searchBuffe...= e->timerId()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2619 d->searchBuffer.clear();-
2620 }
never executed: end of block
0
2621}
never executed: end of block
0
2622-
2623static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *item, QPlatformMenu *itemsMenu)-
2624{-
2625 item->setText(action->text());-
2626 item->setIsSeparator(action->isSeparator());-
2627 if (action->isIconVisibleInMenu()
action->isIconVisibleInMenu()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2628 item->setIcon(action->icon());-
2629 if (QWidget *w = action->parentWidget()
QWidget *w = a...parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2630 QStyleOption opt;-
2631 opt.init(w);-
2632 item->setIconSize(w->style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, w));-
2633 }
never executed: end of block
else {
0
2634 QStyleOption opt;-
2635 item->setIconSize((static_cast<QApplication *>(QCoreApplication::instance()))->style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, 0));-
2636 }
never executed: end of block
0
2637 } else {-
2638 item->setIcon(QIcon());-
2639 }
never executed: end of block
0
2640 item->setVisible(action->isVisible());-
2641 item->setShortcut(action->shortcut());-
2642 item->setCheckable(action->isCheckable());-
2643 item->setChecked(action->isChecked());-
2644 item->setHasExclusiveGroup(action->actionGroup() && action->actionGroup()->isExclusive());-
2645 item->setFont(action->font());-
2646 item->setRole((QPlatformMenuItem::MenuRole) action->menuRole());-
2647 item->setEnabled(action->isEnabled());-
2648-
2649 if (action->menu()
action->menu()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2650 if (!action->menu()->platformMenu()
!action->menu(...platformMenu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2651 action->menu()->setPlatformMenu(itemsMenu->createSubMenu());
never executed: action->menu()->setPlatformMenu(itemsMenu->createSubMenu());
0
2652 item->setMenu(action->menu()->platformMenu());-
2653 }
never executed: end of block
else {
0
2654 item->setMenu(0);-
2655 }
never executed: end of block
0
2656}-
2657-
2658-
2659-
2660-
2661void QMenu::actionEvent(QActionEvent *e)-
2662{-
2663 QMenuPrivate * const d = d_func();-
2664 d->itemsDirty = 1;-
2665 setAttribute(Qt::WA_Resized, false);-
2666 if (d->tornPopup
d->tornPopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2667 d->tornPopup->syncWithMenu(this, e);
never executed: d->tornPopup->syncWithMenu(this, e);
0
2668 if (e->type() == QEvent::ActionAdded
e->type() == Q...t::ActionAddedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2669 if(!d->tornoff
!d->tornoffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2670 connect(e->action(), qFlagLocation("2""triggered()" "\0" __FILE__ ":" "3303"), this, qFlagLocation("1""_q_actionTriggered()" "\0" __FILE__ ":" "3303"));-
2671 connect(e->action(), qFlagLocation("2""hovered()" "\0" __FILE__ ":" "3304"), this, qFlagLocation("1""_q_actionHovered()" "\0" __FILE__ ":" "3304"));-
2672 }
never executed: end of block
0
2673 if (QWidgetAction *wa = qobject_cast<QWidgetAction *>(e->action())
QWidgetAction ...>(e->action())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2674 QWidget *widget = wa->requestWidget(this);-
2675 if (widget
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2676 d->widgetItems.insert(wa, widget);
never executed: d->widgetItems.insert(wa, widget);
0
2677 }
never executed: end of block
0
2678 }
never executed: end of block
else if (e->type() == QEvent::ActionRemoved
e->type() == Q...:ActionRemovedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2679 e->action()->disconnect(this);-
2680 if (e->action() == d->currentAction
e->action() ==...>currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2681 d->currentAction = 0;
never executed: d->currentAction = 0;
0
2682 if (QWidgetAction *wa = qobject_cast<QWidgetAction *>(e->action())
QWidgetAction ...>(e->action())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2683 if (QWidget *widget = d->widgetItems.value(wa)
QWidget *widge...tems.value(wa)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2684 wa->releaseWidget(widget);-
2685 }
never executed: end of block
0
2686 }
never executed: end of block
0
2687 d->widgetItems.remove(e->action());-
2688 }
never executed: end of block
0
2689-
2690 if (!d->platformMenu.isNull()
!d->platformMenu.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2691 if (e->type() == QEvent::ActionAdded
e->type() == Q...t::ActionAddedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2692 QPlatformMenuItem *menuItem = d->platformMenu->createMenuItem();-
2693 menuItem->setTag(reinterpret_cast<quintptr>(e->action()));-
2694 QObject::connect(menuItem, qFlagLocation("2""activated()" "\0" __FILE__ ":" "3337"), e->action(), qFlagLocation("1""trigger()" "\0" __FILE__ ":" "3337"));-
2695 QObject::connect(menuItem, qFlagLocation("2""hovered()" "\0" __FILE__ ":" "3338"), e->action(), qFlagLocation("2""hovered()" "\0" __FILE__ ":" "3338"));-
2696 copyActionToPlatformItem(e->action(), menuItem, d->platformMenu);-
2697 QPlatformMenuItem* beforeItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->before()));-
2698 d->platformMenu->insertMenuItem(menuItem, beforeItem);-
2699 }
never executed: end of block
else if (e->type() == QEvent::ActionRemoved
e->type() == Q...:ActionRemovedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2700 QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->action()));-
2701 d->platformMenu->removeMenuItem(menuItem);-
2702 delete menuItem;-
2703 }
never executed: end of block
else if (e->type() == QEvent::ActionChanged
e->type() == Q...:ActionChangedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2704 QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->action()));-
2705 if (menuItem
menuItemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2706 copyActionToPlatformItem(e->action(), menuItem, d->platformMenu);-
2707 d->platformMenu->syncMenuItem(menuItem);-
2708 }
never executed: end of block
0
2709 }
never executed: end of block
0
2710-
2711 d->platformMenu->syncSeparatorsCollapsible(d->collapsibleSeparators);-
2712 }
never executed: end of block
0
2713 if (isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2714 d->updateActionRects();-
2715 resize(sizeHint());-
2716 update();-
2717 }
never executed: end of block
0
2718}
never executed: end of block
0
2719-
2720-
2721-
2722-
2723void QMenu::internalDelayedPopup()-
2724{-
2725 QMenuPrivate * const d = d_func();-
2726-
2727 if (QMenu *menu = d->activeMenu
QMenu *menu = d->activeMenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2728 if (d->activeMenu->menuAction() != d->currentAction
d->activeMenu-...>currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2729 d->hideMenu(menu);
never executed: d->hideMenu(menu);
0
2730 }
never executed: end of block
0
2731-
2732 if (!d->currentAction
!d->currentActionDescription
TRUEnever evaluated
FALSEnever evaluated
|| !d->currentAction->isEnabled()
!d->currentAction->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
|| !d->currentAction->menu()
!d->currentAction->menu()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
2733 !d->currentAction->menu()->isEnabled()
!d->currentAct...)->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
|| d->currentAction->menu()->isVisible()
d->currentActi...)->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2734 return;
never executed: return;
0
2735-
2736-
2737 d->activeMenu = d->currentAction->menu();-
2738 d->activeMenu->d_func()->causedPopup.widget = this;-
2739 d->activeMenu->d_func()->causedPopup.action = d->currentAction;-
2740-
2741 int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this);-
2742 const QRect actionRect(d->actionRect(d->currentAction));-
2743 const QPoint rightPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top())));-
2744-
2745 d->activeMenu->popup(rightPos);-
2746 d->sloppyState.setSubMenuPopup(actionRect, d->currentAction, d->activeMenu);-
2747-
2748-
2749-
2750-
2751-
2752 if (underMouse()
underMouse()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2753 QEvent leaveEvent(QEvent::Leave);-
2754 QCoreApplication::sendEvent(this, &leaveEvent);-
2755 }
never executed: end of block
0
2756-
2757}
never executed: end of block
0
2758void QMenu::setNoReplayFor(QWidget *noReplayFor)-
2759{-
2760 d_func()->noReplayFor = noReplayFor;-
2761}
never executed: end of block
0
2762-
2763-
2764-
2765QPlatformMenu *QMenu::platformMenu()-
2766{-
2767-
2768 return
never executed: return d_func()->platformMenu;
d_func()->platformMenu;
never executed: return d_func()->platformMenu;
0
2769}-
2770-
2771-
2772-
2773void QMenu::setPlatformMenu(QPlatformMenu *platformMenu)-
2774{-
2775 d_func()->setPlatformMenu(platformMenu);-
2776 d_func()->syncPlatformMenu();-
2777}
never executed: end of block
0
2778bool QMenu::separatorsCollapsible() const-
2779{-
2780 const QMenuPrivate * const d = d_func();-
2781 return
never executed: return d->collapsibleSeparators;
d->collapsibleSeparators;
never executed: return d->collapsibleSeparators;
0
2782}-
2783-
2784void QMenu::setSeparatorsCollapsible(bool collapse)-
2785{-
2786 QMenuPrivate * const d = d_func();-
2787 if (d->collapsibleSeparators == collapse
d->collapsible...rs == collapseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2788 return;
never executed: return;
0
2789-
2790 d->collapsibleSeparators = collapse;-
2791 d->itemsDirty = 1;-
2792 if (isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2793 d->updateActionRects();-
2794 update();-
2795 }
never executed: end of block
0
2796 if (!d->platformMenu.isNull()
!d->platformMenu.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2797 d->platformMenu->syncSeparatorsCollapsible(collapse);
never executed: d->platformMenu->syncSeparatorsCollapsible(collapse);
0
2798}
never executed: end of block
0
2799bool QMenu::toolTipsVisible() const-
2800{-
2801 const QMenuPrivate * const d = d_func();-
2802 return
never executed: return d->toolTipsVisible;
d->toolTipsVisible;
never executed: return d->toolTipsVisible;
0
2803}-
2804-
2805void QMenu::setToolTipsVisible(bool visible)-
2806{-
2807 QMenuPrivate * const d = d_func();-
2808 if (d->toolTipsVisible == visible
d->toolTipsVisible == visibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2809 return;
never executed: return;
0
2810-
2811 d->toolTipsVisible = visible;-
2812}
never executed: end of block
0
2813-
2814-
2815-
2816-
Switch to Source codePreprocessed file

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