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

Adam Treat treat at kde.org
Fri May 25 06:30:47 CEST 2007


SVN commit 668099 by treat:

* Z-Value fixes and resize scene along with view


 M  +1 -0      kstplotcommands.cpp  
 M  +1 -1      kstplotitems.cpp  
 M  +13 -0     kstplotview.cpp  
 M  +1 -0      kstplotview.h  


--- branches/work/kst/portto4/kst/src/libkstapp/kstplotcommands.cpp #668098:668099
@@ -87,6 +87,7 @@
   if (ok && !text.isEmpty()) {
     _item = new LabelItem(text, _view);
     _view->scene()->addItem(_item->graphicsItem());
+    _item->graphicsItem()->setZValue(1);
   }
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotitems.cpp #668098:668099
@@ -32,7 +32,6 @@
 
 LabelItem::LabelItem(const QString &text, KstPlotView *parent)
     : KstPlotItem(parent), QGraphicsSimpleTextItem(text) {
-
 }
 
 
@@ -60,6 +59,7 @@
     parentView()->scene()->addItem(this);
     parentView()->setMouseMode(KstPlotView::Default);
     parentView()->disconnect(this);
+    setZValue(1);
   }
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotview.cpp #668098:668099
@@ -15,6 +15,7 @@
 
 #include <QDebug>
 #include <QUndoStack>
+#include <QResizeEvent>
 #include <QGraphicsScene>
 #include <QGraphicsSceneMouseEvent>
 
@@ -82,6 +83,18 @@
   }
 }
 
+
+void KstPlotView::resizeEvent(QResizeEvent *event) {
+  QGraphicsView::resizeEvent(event);
+  setSceneRect(QRectF(0, 0, event->size().width(), event->size().height()));
+
+  //See what I'm doing
+  QLinearGradient l(0,0,0,event->size().height());
+  l.setColorAt(0, Qt::white);
+  l.setColorAt(1, Qt::lightGray);
+  setBackgroundBrush(l);
+}
+
 #include "kstplotview.moc"
 
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotview.h #668098:668099
@@ -40,6 +40,7 @@
 
 protected:
   bool eventFilter(QObject *obj, QEvent *event);
+  void resizeEvent(QResizeEvent *event);
 
 private:
   QUndoStack *_undoStack;


More information about the Kst mailing list