34 #include "hbeffect.h" |
34 #include "hbeffect.h" |
35 #include "hbeffectinternal_p.h" |
35 #include "hbeffectinternal_p.h" |
36 bool HbMenuPrivate::menuEffectsLoaded = false; |
36 bool HbMenuPrivate::menuEffectsLoaded = false; |
37 #endif |
37 #endif |
38 #include "hbglobal_p.h" |
38 #include "hbglobal_p.h" |
39 |
39 #include <QGraphicsSceneMouseEvent> |
40 #include <QPointer> |
40 #include <QPointer> |
41 |
41 |
42 Q_DECLARE_METATYPE (QAction*)// krazy:exclude=qclasses |
42 Q_DECLARE_METATYPE (QAction*)// krazy:exclude=qclasses |
43 |
43 |
44 HbMenuPrivate::HbMenuPrivate(): |
44 HbMenuPrivate::HbMenuPrivate(): |
269 // huh ? activeSubMenu = 0; |
271 // huh ? activeSubMenu = 0; |
270 } |
272 } |
271 } |
273 } |
272 } |
274 } |
273 |
275 |
|
276 /* |
|
277 reimp |
|
278 */ |
|
279 void HbMenuPrivate::handleBackgroundMouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
280 { |
|
281 Q_Q(HbMenu); |
|
282 |
|
283 // Handle cases only for Background or Popup originated mouse presses and when |
|
284 // any dismiss policy defined |
|
285 if (mousePressLocation != None && dismissPolicy != HbPopup::NoDismiss) { |
|
286 |
|
287 MouseEventLocationType mouseReleaseLocation = Background; |
|
288 HbMenu* tempMenu = 0; |
|
289 QList<QGraphicsItem*> itemList = q->scene()->items(event->pos()); |
|
290 foreach (QGraphicsItem* sceneItem, itemList ){ |
|
291 QGraphicsWidget *focusWidget = 0; |
|
292 HbMenu *focusMenu = 0; |
|
293 if (sceneItem && sceneItem->isWidget()) { |
|
294 focusWidget = static_cast<QGraphicsWidget*>(sceneItem); |
|
295 focusMenu = qobject_cast<HbMenu *>(focusWidget); |
|
296 } |
|
297 if( focusMenu ) { |
|
298 mouseReleaseLocation = Popup; |
|
299 tempMenu = focusMenu; |
|
300 break; |
|
301 } |
|
302 } |
|
303 // Mouse is released within menu |
|
304 if (mouseReleaseLocation == Popup) { |
|
305 HbAction* menuAction = tempMenu->activeAction(); |
|
306 if(menuAction){ |
|
307 mCloseAllMenus = false; |
|
308 closeMenuRecursively(menuAction); |
|
309 } |
|
310 mousePressLocation = None; |
|
311 } |
|
312 else { |
|
313 // trigger the menu to close whole menu |
|
314 mCloseAllMenus = true; |
|
315 q->close(); |
|
316 mousePressLocation = None; |
|
317 } |
|
318 } |
|
319 } |
|
320 |
274 void HbMenuPrivate::_q_subMenuTimedOut() |
321 void HbMenuPrivate::_q_subMenuTimedOut() |
275 { |
322 { |
276 Q_Q(HbMenu); |
323 Q_Q(HbMenu); |
277 if( menuTimedOut (activeSubMenu) ) { |
324 if( menuTimedOut (activeSubMenu) ) { |
278 if ( activeSubMenu ) { |
325 if ( activeSubMenu ) { |