From 9d5308b95bed09e72203eb53ced1a57c21744c71 Mon Sep 17 00:00:00 2001 From: Markku Luukkainen Date: Wed, 27 May 2009 09:48:33 +0200 Subject: Added handling for a case when menu is being rebuilt and menu is not inside a QMainWindow. --- src/gui/widgets/qmenu_symbian.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 491c78e..1ed3505 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -184,19 +184,21 @@ static void rebuildMenu() QMenuBarPrivate *mb = 0; QWidget *w = qApp->activeWindow(); QMainWindow *mainWindow = qobject_cast(w); - QSoftKeyStack* softKeyStack = mainWindow->softKeyStack(); - if (!softKeyStack->isEmpty()) { - const QSoftkeySet& softKeyTop = softKeyStack->top(); - int index=0; - bool found=false; - while( indexrole(); - if(softAction->role() == QSoftKeyAction::ContextMenu) { - widgetWithContextMenu = softAction->parentWidget(); - found=true; - } - index++; + if (mainWindow) { + QSoftKeyStack* softKeyStack = mainWindow->softKeyStack(); + if (!softKeyStack->isEmpty()) { + const QSoftkeySet& softKeyTop = softKeyStack->top(); + int index=0; + bool found=false; + while( indexrole(); + if(softAction->role() == QSoftKeyAction::ContextMenu) { + widgetWithContextMenu = softAction->parentWidget(); + found=true; + } + index++; + } } } -- cgit v0.12