| Summary: | Aspect for fixed aspect view objects can drift on resize | ||
|---|---|---|---|
| Product: | [Applications] kst | Reporter: | Netterfield <netterfield> |
| Component: | general | Assignee: | Duncan Hanson <duncan.hanson> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.x | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Netterfield
2006-07-31 23:36:26 UTC
sounds like resize is being called when it should be parentResize. SVN commit 568580 by dhanson:
CCBUG:131620 fixed. the problem was the myOldGeom did not necessarily have the proper aspect ratio, particularly if _geom.setSize(_geom.size().expandedTo(_minimumSize)); had been called.
M +2 -1 kstviewobject.cpp
M +1 -0 kstviewobject.h
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewobject.cpp #568579:568580
@@ -565,6 +565,7 @@
_aspect.x = xc; // restore position.
_aspect.y = yc;
updateFromAspect();
+ _idealSize = _geom.size();
for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
(*i)->parentResized();
}
@@ -1412,7 +1413,7 @@
_geom.setBottom(geom.top() + int((_aspect.y + _aspect.h) * geom.height()) - 1);
if (_maintainAspect == true) {
- QSize maintaining_size(myOldGeom.size());
+ QSize maintaining_size(_idealSize);
maintaining_size.scale(_geom.size(),QSize::ScaleMin);
_geom.setSize(maintaining_size);
}
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewobject.h #568579:568580
@@ -322,6 +322,7 @@
QGuardedPtr<KstViewObject> _parent; // danger!!
Q_UINT32 _standardActions, _layoutActions;
KstAspectRatio _aspect;
+ QSize _idealSize; //ideal size for object. useful when _maintainAspect==true
KstAspectRatio _aspectOldZoomedObject;
QString _type;
QRegion _clipMask; // The mask of this object
*** Bug has been marked as fixed ***. SVN commit 568594 by dhanson:
CCBUG:131620 add _idealSize to saved session.
M +10 -3 kstviewobject.cpp
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewobject.cpp #568593:568594
@@ -104,6 +104,7 @@
_foregroundColor = viewObject._foregroundColor;
_backgroundColor = viewObject._backgroundColor;
_aspect = viewObject._aspect;
+ _idealSize = viewObject._idealSize;
_standardActions = viewObject._standardActions;
_layoutActions = viewObject._layoutActions;
_maximized = false;
@@ -156,6 +157,9 @@
_aspect.y = el.attribute("y", "0.0").toDouble();
_aspect.w = el.attribute("w", "1.0").toDouble();
_aspect.h = el.attribute("h", "1.0").toDouble();
+ } else if (el.tagName() == "idealsize") {
+ _idealSize.setWidth(el.attribute("w", "1").toInt());
+ _idealSize.setHeight(el.attribute("h", "1").toInt());
}
}
n = n.nextSibling();
@@ -289,6 +293,9 @@
"\" w=\"" << aspect.w <<
"\" h=\"" << aspect.h << "\" />" << endl;
+ ts << indent << "<idealsize w=\"" << _idealSize.width() <<
+ "\" h=\"" << _idealSize.height() <<"\" />" << endl;
+
// save all properties
for (int i = 0; i < metaObject()->numProperties(true); i++) {
ts << indent << "<" << metaObject()->property(i, true)->name() << ">";
@@ -565,7 +572,6 @@
_aspect.x = xc; // restore position.
_aspect.y = yc;
updateFromAspect();
- _idealSize = _geom.size();
for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
(*i)->parentResized();
}
@@ -1453,6 +1459,7 @@
void KstViewObject::updateAspect() {
+ _idealSize = _geom.size();
updateAspectSize();
updateAspectPos();
setDirty();
@@ -1570,7 +1577,7 @@
str << tagName();
str << _geom << _backgroundColor << _foregroundColor;
// _parent should not be sent since it is meaningless in a drag context
- str << _standardActions << _layoutActions << _aspect;
+ str << _standardActions << _layoutActions << _aspect << _idealSize;
str << _children.count();
for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
@@ -1592,7 +1599,7 @@
kstdDebug() << "Decoding " << tagName << " from drag." << endl;
// FIXME: rename objects if they cause a namespace conflict
str >> _geom >> _backgroundColor >> _foregroundColor;
- str >> _standardActions >> _layoutActions >> _aspect;
+ str >> _standardActions >> _layoutActions >> _aspect >> _idealSize;
_children.clear();
uint cc = 0;
|