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

Barth Netterfield netterfield at astro.utoronto.ca
Fri Jan 30 16:00:33 CET 2009


SVN commit 918704 by netterfield:

Fix centering of left and right labels
Slightly increase size of plot selector circle.



 M  +0 -5      devel-docs/Kst2Specs/Bugs  
 M  +1 -0      devel-docs/Kst2Specs/FixedBugs  
 M  +10 -16    src/libkstapp/plotitem.cpp  
 M  +1 -1      src/libkstapp/plotrenderitem.cpp  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #918703:918704
@@ -10,11 +10,6 @@
 
 ---------
 
-Formatting/spacing issues:
-  -The plot selection buttons are too small.
-*cbn*
----------
-
 Tooltips everywhere.
 
 ---------
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/FixedBugs #918703:918704
@@ -421,3 +421,4 @@
 Formatting/spacing issues:
   -The spacing between the X-axis numbers and the axis is too small.
   -The spacing between the Y-axis numbers and the axis doesn't seem to scale with window size.
+  -The plot selection buttons are too small.
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #918703:918704
@@ -481,6 +481,7 @@
 
 void PlotItem::marginsUpdated() {
   ViewGridLayout::standardizePlotMargins(this);
+  //qDebug() << "---Margins updated called";
   if (isInSharedAxisBox() && parentItem()) {
     if (SharedAxisBoxItem *sharedBox = qgraphicsitem_cast<SharedAxisBoxItem*>(parentItem())) {
       sharedBox->sharePlots();
@@ -522,6 +523,9 @@
   painter->save();
   painter->setFont(calculatedNumberLabelFont());
 
+  // FIXME: the plot size calculations need to be separated from the 
+  // painting to avoid n^2 or worse behavior.
+
   calculateBottomTickLabelBound(painter);
   calculateLeftTickLabelBound(painter);
   //setCalculatedAxisMarginWidth(calculateLeftTickLabelBound(painter).width());
@@ -1624,14 +1628,6 @@
 }
 
 
-// void PlotItem::setCalculatedLabelMarginHeight(qreal marginHeight) {
-//   qreal before = this->calculatedLabelMarginHeight();
-//   _calculatedLabelMarginHeight = marginHeight;
-//   if (before != this->calculatedLabelMarginHeight())
-//     emit marginsChanged();
-// }
-
-
 qreal PlotItem::calculatedTopLabelMargin() const {
   qreal m = qMax(_calculatedAxisMarginTOverflow, _calculatedTopLabelMargin);
 
@@ -1761,7 +1757,7 @@
     Label::renderLabel(rc, parsed->chunk);
 
     leftLabel.moveTopRight(plotAxisRect().topLeft());
-    leftLabel.moveBottomLeft(QPointF(leftLabel.bottomLeft().x(), leftLabel.bottomLeft().y() - ((leftLabel.height() / 2) - (rc.x / 2))));
+    leftLabel.moveBottomLeft(QPointF(leftLabel.bottomLeft().x(), plotRect().center().y()+ rc.x / 2));
 
     painter->save();
     QTransform t;
@@ -1904,8 +1900,7 @@
       rc.y = fm.ascent();
       Label::renderLabel(rc, parsed->chunk);
 
-      rightLabel.moveTopLeft(plotAxisRect().topRight());
-      rightLabel.moveTopLeft(QPointF(rightLabel.topLeft().x(), rightLabel.topLeft().y() + ((rightLabel.height() / 2) - (rc.x) / 2)));
+      rightLabel.moveTopLeft(QPointF(plotAxisRect().right(), plotRect().center().y() - rc.x / 2));
 
       painter->save();
       QTransform t;
@@ -2091,9 +2086,9 @@
 
   _calculatedAxisMarginHeight = xLabelRect.height();
   if (xLabelRect.right() > plotRect().right()) {
-    _calculatedAxisMarginROverflow = qMax(ViewItem::sizeOfGrip().width()/1.2, xLabelRect.right() - plotRect().right());
+    _calculatedAxisMarginROverflow = qMax(ViewItem::sizeOfGrip().width(), xLabelRect.right() - plotRect().right());
   } else {
-    _calculatedAxisMarginROverflow = ViewItem::sizeOfGrip().width()/1.2;
+    _calculatedAxisMarginROverflow = ViewItem::sizeOfGrip().width();
   }
 
   if ((inHeight != _calculatedAxisMarginHeight) 
@@ -2125,7 +2120,6 @@
       yLabelIt.next();
 
       QRectF bound = painter->boundingRect(QRectF(), flags, yLabelIt.value());
-      //bound.setWidth(bound.width() + 6);
       QPointF p(plotRect().left() - bound.width() / 2.0 - _calculatedAxisMarginHLead, mapYToPlot(yLabelIt.key()));
       bound.moveCenter(p);
 
@@ -2146,9 +2140,9 @@
   }
   _calculatedAxisMarginWidth = yLabelRect.width();
   if (yLabelRect.top() < plotRect().top()) {
-    _calculatedAxisMarginTOverflow = qMax(ViewItem::sizeOfGrip().width()/1.2, -yLabelRect.top() + plotRect().top());
+    _calculatedAxisMarginTOverflow = qMax(ViewItem::sizeOfGrip().width(), -yLabelRect.top() + plotRect().top());
   } else {
-    _calculatedAxisMarginTOverflow = ViewItem::sizeOfGrip().width()/1.2;
+    _calculatedAxisMarginTOverflow = ViewItem::sizeOfGrip().width();
   }
   if ((inWidth != _calculatedAxisMarginWidth) 
        || (inHLead != _calculatedAxisMarginHLead) 
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #918703:918704
@@ -540,7 +540,7 @@
 
 
 QSizeF PlotRenderItem::sizeOfGrip() const {
-  return ViewItem::sizeOfGrip() / 1.2;
+  return ViewItem::sizeOfGrip();// / 1.2;
 }
 
 


More information about the Kst mailing list