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

Mike Fenton mike at staikos.net
Fri Mar 13 16:12:45 CET 2009


SVN commit 939015 by fenton:

Removal of ViewItemZOrder default values.
All objects are now created equally and modified by user command.


 M  +0 -2      arrowitem.cpp  
 M  +0 -3      boxitem.cpp  
 M  +0 -4      circleitem.cpp  
 M  +0 -3      ellipseitem.cpp  
 M  +0 -3      labelitem.cpp  
 M  +0 -3      layoutboxitem.cpp  
 M  +0 -2      legenditem.cpp  
 M  +0 -3      lineitem.cpp  
 M  +0 -2      pictureitem.cpp  
 M  +2 -3      plotitem.cpp  
 M  +0 -2      plotrenderitem.cpp  
 M  +0 -2      sharedaxisboxitem.cpp  
 M  +0 -4      svgitem.cpp  
 M  +3 -3      viewitem.cpp  
 D             viewitemzorder.h  


--- branches/work/kst/portto4/kst/src/libkstapp/arrowitem.cpp #939014:939015
@@ -12,7 +12,6 @@
 #include "arrowitem.h"
 
 #include "view.h"
-#include "viewitemzorder.h"
 #include "arrowitemdialog.h"
 
 #include "math_kst.h"
@@ -32,7 +31,6 @@
   _startArrowScale(1.0),
   _endArrowScale(1.0) {
   setTypeName("Arrow");
-  setZValue(ARROW_ZVALUE);
   QBrush b = brush();
   b.setStyle(Qt::SolidPattern);
   setBrush(b);
--- branches/work/kst/portto4/kst/src/libkstapp/boxitem.cpp #939014:939015
@@ -11,8 +11,6 @@
 
 #include "boxitem.h"
 
-#include "viewitemzorder.h"
-
 #include <debug.h>
 
 #include <QDebug>
@@ -23,7 +21,6 @@
 BoxItem::BoxItem(View *parent)
     : ViewItem(parent) {
   setTypeName("Box");
-  setZValue(BOX_ZVALUE);
   setBrush(Qt::white);
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/circleitem.cpp #939014:939015
@@ -11,8 +11,6 @@
 
 #include "circleitem.h"
 
-#include "viewitemzorder.h"
-
 #include <debug.h>
 
 #include <QDebug>
@@ -23,7 +21,6 @@
 CircleItem::CircleItem(View *parent)
     : ViewItem(parent) {
   setTypeName("Circle");
-  setZValue(CIRCLE_ZVALUE);
   setBrush(Qt::white);
   setLockAspectRatio(true);
   setLockAspectRatioFixed(true);
@@ -60,7 +57,6 @@
     setPos(poly.first().x(), poly.first().y());
     setViewRect(QRectF(0.0, 0.0, 0.0, sizeOfGrip().height()));
     parentView()->scene()->addItem(this);
-    //setZValue(1);
     return;
   }
 
--- branches/work/kst/portto4/kst/src/libkstapp/ellipseitem.cpp #939014:939015
@@ -11,8 +11,6 @@
 
 #include "ellipseitem.h"
 
-#include "viewitemzorder.h"
-
 #include <QDebug>
 #include <QGraphicsItem>
 #include <QGraphicsScene>
@@ -24,7 +22,6 @@
 EllipseItem::EllipseItem(View *parent)
   : ViewItem(parent) {
   setTypeName("Ellipse");
-  setZValue(ELLIPSE_ZVALUE);
   setBrush(Qt::white);
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/labelitem.cpp #939014:939015
@@ -13,7 +13,6 @@
 
 #include <labelparser.h>
 #include "labelrenderer.h"
-#include "viewitemzorder.h"
 #include "labelitemdialog.h"
 #include "labelcreator.h"
 
@@ -31,8 +30,6 @@
 LabelItem::LabelItem(View *parent, const QString& txt)
   : ViewItem(parent), _parsed(0), _text(txt) {
   setTypeName("Label");
-  setZValue(LABEL_ZVALUE);
-
   setFixedSize(true);
   setAllowedGripModes(Move /*| Resize*/ | Rotate /*| Scale*/);
   _font = parentView()->defaultFont();
--- branches/work/kst/portto4/kst/src/libkstapp/layoutboxitem.cpp #939014:939015
@@ -12,7 +12,6 @@
 #include "layoutboxitem.h"
 
 #include "viewgridlayout.h"
-#include "viewitemzorder.h"
 
 #include "debug.h"
 #include <QDebug>
@@ -26,13 +25,11 @@
 LayoutBoxItem::LayoutBoxItem(View *parent)
     : ViewItem(parent) {
   setTypeName("Layout Box");
-  setZValue(LAYOUTBOX_ZVALUE);
   setPen(Qt::NoPen);
   setBrush(Qt::NoBrush);
   setAllowedGripModes(Move);
 
   parentView()->scene()->addItem(this);
-  //setZValue(1);
   setPos(parentView()->sceneRect().topLeft());
   setViewRect(parentView()->sceneRect());
 
--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.cpp #939014:939015
@@ -11,7 +11,6 @@
 
 #include "legenditem.h"
 
-#include "viewitemzorder.h"
 #include <labelparser.h>
 #include "labelrenderer.h"
 
@@ -38,7 +37,6 @@
 LegendItem::LegendItem(PlotItem *parent)
   : ViewItem(parent->parentView()), _plotItem(parent), _auto(true), _fontScale(0.0), _verticalDisplay(true) {
   setTypeName("Legend");
-  setZValue(LEGEND_ZVALUE);
 
   setAllowedGripModes(Move /*| Resize*/ /*| Rotate*/ /*| Scale*/);
 
--- branches/work/kst/portto4/kst/src/libkstapp/lineitem.cpp #939014:939015
@@ -12,7 +12,6 @@
 #include "lineitem.h"
 
 #include "view.h"
-#include "viewitemzorder.h"
 
 #include <debug.h>
 
@@ -25,7 +24,6 @@
 LineItem::LineItem(View *parent)
   : ViewItem(parent) {
   setTypeName("Line");
-  setZValue(LINE_ZVALUE);
   setAllowedGrips(RightMidGrip | LeftMidGrip);
   setAllowedGripModes(Resize);
   setAllowsLayout(false);
@@ -122,7 +120,6 @@
     setPos(poly.first().x(), poly.first().y());
     setViewRect(QRectF(0.0, 0.0, 0.0, sizeOfGrip().height()));
     parentView()->scene()->addItem(this);
-    //setZValue(1);
     return;
   }
 
--- branches/work/kst/portto4/kst/src/libkstapp/pictureitem.cpp #939014:939015
@@ -11,7 +11,6 @@
 
 #include "pictureitem.h"
 
-#include "viewitemzorder.h"
 #include "debug.h"
 
 #include <QDebug>
@@ -28,7 +27,6 @@
     _image = QPixmap::fromImage(image);
   }
   setTypeName("Picture");
-  setZValue(PICTURE_ZVALUE);
   setLockAspectRatio(true);
   setLockAspectRatioFixed(true);
 }
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #939014:939015
@@ -11,7 +11,6 @@
 
 #include "plotitem.h"
 
-#include "viewitemzorder.h"
 #include "plotitemmanager.h"
 #include "plotrenderitem.h"
 
@@ -52,6 +51,7 @@
 // FIXME:no magic numbers in pixels
 static qreal BOTTOM_MARGIN = 0.0;
 static qreal LEFT_MARGIN = 0.0;
+static const int PLOT_MAXIMIZED_ZORDER = 1000;
 
 namespace Kst {
 
@@ -90,7 +90,6 @@
 {
 
   setTypeName("Plot");
-  setZValue(PLOT_ZVALUE);
   setBrush(Qt::white);
 
   setSupportsTiedZoom(true);
@@ -2414,7 +2413,7 @@
     setParent(0);
     setPos(0, 0);
     setViewRect(parentView()->sceneRect());
-    setZValue(1000);
+    setZValue(PLOT_MAXIMIZED_ZORDER);
     PlotItemManager::self()->setFocusPlot(this);
   }
 }
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #939014:939015
@@ -12,7 +12,6 @@
 #include "plotrenderitem.h"
 
 #include "plotitem.h"
-#include "viewitemzorder.h"
 #include "plotitemmanager.h"
 #include "application.h"
 #include "objectstore.h"
@@ -38,7 +37,6 @@
   : ViewItem(parentItem->parentView()), _referencePointMode(false), _highlightPointActive(false), _invertHighlight(false) {
 
   setTypeName(tr("Plot Render"));
-  setZValue(PLOTRENDER_ZVALUE);
   setParent(parentItem);
   setHasStaticGeometry(true);
   setAllowedGripModes(0);
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.cpp #939014:939015
@@ -11,7 +11,6 @@
 
 #include "sharedaxisboxitem.h"
 
-#include "viewitemzorder.h"
 #include "plotitem.h"
 #include "plotitemmanager.h"
 
@@ -32,7 +31,6 @@
 SharedAxisBoxItem::SharedAxisBoxItem(View *parent)
     : ViewItem(parent), _layout(0), _loaded(false), _dirty(false) {
   setTypeName("Shared Axis Box");
-  setZValue(SHAREDAXISBOX_ZVALUE);
   setBrush(Qt::transparent);
 
   _breakAction = new QAction(tr("Break Shared Axis Box"), this);
--- branches/work/kst/portto4/kst/src/libkstapp/svgitem.cpp #939014:939015
@@ -12,8 +12,6 @@
 #include "svgitem.h"
 #include "debug.h"
 
-#include "viewitemzorder.h"
-
 #include <QDebug>
 #include <QFileDialog>
 #include <QGraphicsScene>
@@ -36,9 +34,7 @@
   } else {
     _svg = new QSvgRenderer();
   }
-  //FIXME need to set the element id??
   setTypeName("Svg");
-  setZValue(SVG_ZVALUE);
   setLockAspectRatio(true);
   setLockAspectRatioFixed(true);
 }
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #939014:939015
@@ -36,6 +36,7 @@
 static const double ONE_PI = 3.14159265358979323846264338327950288419717;
 static double TWO_PI = 2.0 * ONE_PI;
 static double RAD2DEG = 180.0 / ONE_PI;
+static const int DRAWING_ZORDER = 500;
 
 #define DEBUG_GEOMETRY 0
 #define DEBUG_REPARENT 0
@@ -70,7 +71,7 @@
     _parentRelativeWidth(0)
  {
 
-  setZValue(1);
+  setZValue(DRAWING_ZORDER);
   setAcceptsHoverEvents(true);
   setFlags(ItemIsMovable | ItemIsSelectable | ItemIsFocusable);
   connect(parent, SIGNAL(mouseModeChanged(View::MouseMode)),
@@ -773,7 +774,6 @@
     setViewRect(0.0, 0.0, 0.0, 0.0);
     parentView()->scene()->addItem(this);
     _creationState = InProgress;
-    //setZValue(1);
     return;
   }
 
@@ -800,6 +800,7 @@
     maybeReparent();
     _creationState = Completed;
     emit creationComplete();
+    setZValue(1);
     return;
   }
 }
@@ -1965,7 +1966,6 @@
 
   item->setPos(center);
   item->setViewRect(0.0, 0.0, 200.0, 200.0);
-  //_item->setZValue(1);
   _item->parentView()->scene()->addItem(item);
 
   if (layout == CurvePlacement::Auto) {


More information about the Kst mailing list