[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Fri Apr 3 21:34:02 CEST 2009
SVN commit 948786 by fenton:
Fix multiple Plot updates triggered on zoom actions.
M +13 -0 plotitem.cpp
M +1 -0 plotitem.h
M +6 -5 viewgridlayout.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #948785:948786
@@ -1074,6 +1074,19 @@
}
+void PlotItem::setPadding(const qreal left, const qreal right, const qreal top, const qreal bottom) {
+ if ((left == _leftPadding) && (right == _rightPadding) && (top == _topPadding) && (bottom == _bottomPadding)) {
+ return;
+ }
+ _leftPadding = left;
+ _rightPadding = right;
+ _topPadding = top;
+ _bottomPadding = bottom;
+ setPlotRectsDirty();
+ updatePlotRect();
+}
+
+
void PlotItem::setLeftPadding(const qreal padding) {
if (padding != _leftPadding) {
_leftPadding = padding;
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #948785:948786
@@ -150,6 +150,7 @@
SharedAxisBoxItem* sharedAxisBox();
void setSharedAxisBox(SharedAxisBoxItem* parent);
+ void setPadding(const qreal, const qreal, const qreal, const qreal);
void setLeftPadding(const qreal);
void setBottomPadding(const qreal);
void setRightPadding(const qreal);
--- branches/work/kst/portto4/kst/src/libkstapp/viewgridlayout.cpp #948785:948786
@@ -281,11 +281,12 @@
qDebug() << "Margin bottom height is " << plotItem->bottomMarginSize() << "setting to" << bottomMarginHeights[floor(plotItem->height()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->bottomMarginSize();
#endif
- plotItem->setLeftPadding(leftMarginWidths[floor(plotItem->width()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->leftMarginSize());
- plotItem->setRightPadding(rightMarginWidths[floor(plotItem->width()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->rightMarginSize());
- plotItem->setTopPadding(topMarginWidths[floor(plotItem->height()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->topMarginSize());
- plotItem->setBottomPadding(bottomMarginHeights[floor(plotItem->height()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->bottomMarginSize());
- emit plotItem->updatePlotRect();
+ qreal leftPadding = leftMarginWidths[floor(plotItem->width()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->leftMarginSize();
+ qreal rightPadding = rightMarginWidths[floor(plotItem->width()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->rightMarginSize();
+ qreal topPadding = topMarginWidths[floor(plotItem->height()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->topMarginSize();
+ qreal bottomPadding = bottomMarginHeights[floor(plotItem->height()*PLOT_STANDARDIZATION_FACTOR)] - plotItem->bottomMarginSize();
+
+ plotItem->setPadding(leftPadding, rightPadding, topPadding, bottomPadding);
}
}
More information about the Kst
mailing list