[Uml-devel] KDE/kdesdk/umbrello/umbrello

Sharan Rao sharanrao at gmail.com
Wed Dec 19 21:15:30 UTC 2007


SVN commit 750675 by sharan:

QHash returns a 0 , when if it doesn't get a match. This interferes with an expected 0 value for mt_model
Hence, check if we have a valid QHash entry first.



 M  +7 -2      listpopupmenu.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/listpopupmenu.cpp #750674:750675
@@ -1623,8 +1623,13 @@
 
 ListPopupMenu::Menu_Type ListPopupMenu::getMenuType(QAction* action)
 {
-    Menu_Type mt = m_actions.key(action);
-    return mt;
+    QList<Menu_Type> keyList = m_actions.keys( action );
+    if ( keyList.empty() || /* all key-value pairs are unique*/ keyList.count() > 1 ) {
+        return mt_Undefined;
+    } else {
+        // we return the first ( only ) value
+        return keyList.first();
+    }
 }
 
 void ListPopupMenu::setActionChecked(Menu_Type idx, bool value)




More information about the umbrello-devel mailing list