[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Mon Jan 30 18:50:31 CET 2006
SVN commit 503880 by staikos:
merge #2 from the branch: make positioning relative to the plot region work
M +16 -5 kst2dplot.cpp
M +3 -3 kstviewobject.cpp
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #503879:503880
@@ -2163,8 +2163,21 @@
void Kst2DPlot::resize(const QSize& size) {
+ // FIXME
+ // Horribly inefficient, but we need to update contentsRect() somehow
+ // before the base class resize happens.
+ _buffer.buffer().resize(size);
+ assert(!_buffer.buffer().isNull()); // Want to find these crashes
+ if (!_buffer.buffer().isNull()) { // Because this is garbage
+ _buffer.buffer().fill(backgroundColor());
+ KstPainter p;
+ p.begin(&_buffer.buffer());
+ p.setWindow(0, 0, size.width(), size.height());
+ draw(p);
+ p.end();
+ }
KstPlotBase::resize(size);
- setDirty();
+ setDirty(false);
}
@@ -2581,6 +2594,7 @@
return QRect(left, top, dim, dim);
}
+
void Kst2DPlot::setPixRect(const QRect& RelPlotRegion, const QRect& RelWinRegion, const QRect& RelPlotAndAxisRegion) {
PlotRegion = RelPlotRegion;
PlotRegion.moveBy(geometry().x(), geometry().y());
@@ -6542,10 +6556,7 @@
QRect Kst2DPlot::contentsRect() const {
- return QRect(PlotRegion.left() + geometry().left(),
- PlotRegion.top() + geometry().top(),
- PlotRegion.width(),
- PlotRegion.height());
+ return PlotRegion;
}
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #503879:503880
@@ -1390,7 +1390,7 @@
void KstViewObject::updateFromAspect() {
setMinimumSize(minimumSize().expandedTo(QSize(_children.count(), _children.count())));
if (_parent) {
- const QRect geom(_parent->geometry());
+ const QRect geom(_parent->contentsRect());
_geom.setLeft(geom.left() + int(_aspect.x * geom.width()));
_geom.setTop(geom.top() + int(_aspect.y * geom.height()));
_geom.setRight(geom.left() + int((_aspect.x + _aspect.w) * geom.width()) - 1);
@@ -1406,7 +1406,7 @@
void KstViewObject::updateAspectPos() {
if (_parent) {
- const QRect geom(_parent->geometry());
+ const QRect geom(_parent->contentsRect());
_aspect.x = double(geometry().left() - geom.left()) / double(geom.width());
_aspect.y = double(geometry().top() - geom.top()) / double(geom.height());
} else {
@@ -1418,7 +1418,7 @@
void KstViewObject::updateAspectSize() {
if (_parent) {
- const QRect geom(_parent->geometry());
+ const QRect geom(_parent->contentsRect());
_aspect.w = double(geometry().width()) / double(geom.width());
_aspect.h = double(geometry().height()) / double(geom.height());
} else {
More information about the Kst
mailing list