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

Andi Fischer andi.fischer at hispeed.ch
Mon Sep 24 20:32:18 UTC 2012


SVN commit 1317624 by fischer:

Popup menu position on scene fixed.

 M  +2 -2      listpopupmenu.cpp  
 M  +2 -2      listpopupmenu.h  
 M  +1 -1      toolbarstatearrow.cpp  
 M  +0 -1      toolbarstatearrow.h  
 M  +28 -6     umlscene.cpp  
 M  +3 -2      umlscene.h  
 M  +1 -0      umlview.cpp  
 M  +5 -4      widgets/widgetbase.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/listpopupmenu.cpp #1317623:1317624
@@ -291,7 +291,7 @@
         return;
     WidgetBase::WidgetType type = object->baseType();
     // uDebug() << "ListPopupMenu created with multi=" << multi << " , unique="
-    //          << unique << " for WidgetType=" << type;
+    //          << unique << " for WidgetType=" << WidgetBase::toString(type);
 
     if (multi) {
         ClassifierWidget *c = NULL;
@@ -585,7 +585,7 @@
         }
         break;
     default:
-        uWarning() << "unhandled WidgetType " << type;
+        uWarning() << "unhandled WidgetType " << WidgetBase::toString(type);
         break;
     }//end switch
 
--- trunk/KDE/kdesdk/umbrello/umbrello/listpopupmenu.h #1317623:1317624
@@ -4,7 +4,7 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2003-2011                                               *
+ *   copyright (C) 2003-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -19,7 +19,7 @@
 #include <kmenu.h>
 // #include <kaction.h>
 
-#include <QtCore/QHash>
+#include <QHash>
 
 class UMLView;
 class ClassifierWidget;
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstatearrow.cpp #1317623:1317624
@@ -126,7 +126,7 @@
             delete m_selectionRect.takeFirst();
         m_selectionRect.clear();
     } else if (m_pMouseEvent->button() == Qt::RightButton) {
-        m_pUMLScene->setMenu();
+        m_pUMLScene->setMenu(m_pMouseEvent->scenePos().toPoint());
     }
 }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstatearrow.h #1317623:1317624
@@ -29,7 +29,6 @@
 {
     Q_OBJECT
 public:
-
     ToolBarStateArrow(UMLScene *umlScene);
     virtual ~ToolBarStateArrow();
 
--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.cpp #1317623:1317624
@@ -368,7 +368,7 @@
  */
 const QColor& UMLScene::gridDotColor() const
 {
-    return m_Options.uiState.gridDotColor;
+    return m_layoutGrid->gridDotColor();
 }
 
 /**
@@ -378,8 +378,9 @@
  */
 void UMLScene::setGridDotColor(const QColor& color)
 {
-    m_Options.uiState.gridDotColor = color;
-    emit sigGridColorChanged(ID());
+    m_layoutGrid->setGridDotColor(color);
+    m_layoutGrid->setGridCrossColor(color);
+    m_layoutGrid->setTextColor(color);
 }
 
 /**
@@ -3140,10 +3141,29 @@
 }
 
 /**
+ * Event handler for context menu events.
+ */
+void UMLScene::contextMenuEvent(UMLSceneContextMenuEvent* contextMenuEvent)
+{
+    UMLWidget* widget = widgetAt(contextMenuEvent->scenePos());
+    if (widget) {
+        DEBUG(DBG_SRC) << "widget = " << widget->name() << " / type = " << widget->baseTypeStr();
+//:TODO:        widget->contextMenuEvent(contextMenuEvent);
+    }
+    else {
+        // set the position for the eventually created widget
+        setPos(contextMenuEvent->scenePos());
+
+        setMenu(contextMenuEvent->screenPos());
+        contextMenuEvent->accept();
+    }
+}
+
+/**
  * Sets the popup menu to use when clicking on a diagram background
  * (rather than a widget or listView).
  */
-void UMLScene::setMenu()
+void UMLScene::setMenu(const QPoint& pos)
 {
     slotRemovePopupMenu();
     ListPopupMenu::MenuType menu = ListPopupMenu::mt_Undefined;
@@ -3193,8 +3213,10 @@
         // DEBUG(DBG_SRC) << "create popup for MenuType " << ListPopupMenu::toString(menu);
         m_pMenu = new ListPopupMenu(activeView(), menu, activeView());
         connect(m_pMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotMenuSelection(QAction*)));
-		//activeView()->mapToGlobal(activeView()->contentsToViewport(activeView()->worldMatrix().map(m_Pos))));
-        m_pMenu->popup(pos().toPoint());
+
+        // [PORT] Calculate using activeView once its implementation is done.
+        //QPoint point = m_Pos.toPoint();
+        m_pMenu->popup(pos);
     }
 }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.h #1317623:1317624
@@ -396,7 +396,8 @@
 
     bool isSavedInSeparateFile();
 
-    void setMenu();
+    void setMenu(const QPoint& pos);
+
     void resetToolbar();
 
     bool getPaste() const;
@@ -512,7 +513,6 @@
     UMLSceneItemList collisions(const UMLScenePoint &p);
 
 protected:
-
     // Methods and members related to loading/saving
 
     bool loadWidgetsFromXMI(QDomElement & qElement);
@@ -552,6 +552,7 @@
     void mousePressEvent(UMLSceneMouseEvent* mouseEvent);
     void mouseDoubleClickEvent(UMLSceneMouseEvent* mouseEvent);
     void mouseReleaseEvent(UMLSceneMouseEvent* mouseEvent);
+    virtual void contextMenuEvent(UMLSceneContextMenuEvent * contextMenuEvent);
 
     UMLSceneRect diagramRect();
 
--- trunk/KDE/kdesdk/umbrello/umbrello/umlview.cpp #1317623:1317624
@@ -35,6 +35,7 @@
     setDragMode(NoDrag);
     setScene(m_scene);
 }
+
 /**
  * Destructor.
  */
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widgetbase.h #1317623:1317624
@@ -13,10 +13,11 @@
 
 #include "basictypes.h"
 
-#include <QtCore/QObject>
-#include <QtGui/QColor>
-#include <QtGui/QPainter>
-#include <QtXml/QDomDocument>
+#include <QColor>
+#include <QDomDocument>
+#include <QGraphicsObject>
+#include <QObject>
+#include <QPainter>
 
 // forward declarations
 class UMLDoc;




More information about the umbrello-devel mailing list