[Kst] branches/work/kst/portto4/kst/src/libkstapp

Adam Treat treat at kde.org
Sat Aug 25 05:02:33 CEST 2007


SVN commit 704487 by treat:

* Place items and ignore events for plots in layout


 M  +1 -1      plotitem.h  
 M  +3 -1      plotlayoutitem.cpp  
 M  +22 -0     viewitem.cpp  
 M  +3 -0      viewitem.h  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #704486:704487
@@ -31,7 +31,7 @@
     PlotItem(View *parent);
     virtual ~PlotItem();
 
-    enum { Type = UserType + 1 };
+    enum { Type = UserType + 2 };
     int type() const { return Type; }
 
     void paint(QPainter *painter);
--- branches/work/kst/portto4/kst/src/libkstapp/plotlayoutitem.cpp #704486:704487
@@ -39,7 +39,9 @@
     Q_ASSERT(plotItem);
 
     QPointF topLeft(0, itemHeight);
-    plotItem->setViewRect(QRectF(topLeft, QSizeF(width(), height() / plotItems.count())));
+    plotItem->resetTransform();
+    plotItem->setPos(topLeft);
+    plotItem->setViewRect(QRectF(QPoint(0,0), QSizeF(width(), height() / plotItems.count())));
     itemHeight += height() / plotItems.count();
   }
 }
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #704486:704487
@@ -390,6 +390,11 @@
 
 void ViewItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
 
+  if (ViewItem *item = qgraphicsitem_cast<ViewItem*>(parentItem())) {
+    event->ignore();
+    return;
+  }
+
   if (parentView()->mouseMode() == View::Default) {
     if (mouseMode() == ViewItem::Default ||
         mouseMode() == ViewItem::Move ||
@@ -641,11 +646,23 @@
 
 
 void ViewItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
+
+  if (ViewItem *item = qgraphicsitem_cast<ViewItem*>(parentItem())) {
+    event->ignore();
+    return;
+  }
+
   edit();
 }
 
 
 void ViewItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
+
+  if (ViewItem *item = qgraphicsitem_cast<ViewItem*>(parentItem())) {
+    event->ignore();
+    return;
+  }
+
   QPointF p = event->pos();
   if (topLeftGrip().contains(p)) {
     setActiveGrip(TopLeftGrip);
@@ -673,6 +690,11 @@
 
 void ViewItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
 
+  if (ViewItem *item = qgraphicsitem_cast<ViewItem*>(parentItem())) {
+    event->ignore();
+    return;
+  }
+
   if (parentView()->mouseMode() != View::Default) {
     parentView()->setMouseMode(View::Default);
     parentView()->undoStack()->endMacro();
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #704486:704487
@@ -37,6 +37,9 @@
   ViewItem(View *parent);
   virtual ~ViewItem();
 
+  enum { Type = UserType + 1 };
+  int type() const { return Type; }
+
   View *parentView() const;
 
   MouseMode mouseMode() const;


More information about the Kst mailing list