[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Wed Mar 23 04:40:44 CET 2005
CVS commit by staikos:
How to fix 102221 properly, but not really fully or properly done. There's lots
of tweaking to be done, especially on the UI side. We should stop the resize
at minimumSize(), for instance. There are also some interesting hacks in there.
BUG: 102221
M +21 -3 kstviewobject.cpp 1.125
M +5 -1 kstviewobject.h 1.96
--- kdeextragear-2/kst/kst/kstviewobject.cpp #1.124:1.125
@@ -51,4 +51,5 @@ KstViewObject::KstViewObject(const QStri
_foregroundColor = KstSettings::globalSettings()->foregroundColor;
_backgroundColor = KstSettings::globalSettings()->backgroundColor;
+ setMinimumSize(QSize(1, 1));
}
@@ -58,4 +59,5 @@ KstViewObject::KstViewObject(const QDomE
_backgroundColor = KstSettings::globalSettings()->backgroundColor;
_parent = 0L;
+ setMinimumSize(QSize(1, 1));
load(e);
}
@@ -75,4 +77,5 @@ KstViewObject::KstViewObject(const KstVi
_selected = false;
_geom = viewObject._geom;
+ setMinimumSize(QSize(1, 1));
setContentsRect(viewObject.contentsRect());
@@ -364,7 +367,6 @@ KstViewObjectList& KstViewObject::childr
void KstViewObject::resize(const QSize& size) {
- assert(size.width() > 0);
- assert(size.height() > 0);
- _geom.setSize(size);
+ setMinimumSize(minimumSize().expandedTo(QSize(_children.count(), _children.count())));
+ _geom.setSize(size.expandedTo(_minimumSize));
updateAspect();
for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
@@ -981,4 +985,5 @@ void KstViewObject::copyTo(int id) {
void KstViewObject::updateFromAspect() {
// FIXME: eliminate _parent!!
+ setMinimumSize(minimumSize().expandedTo(QSize(_children.count(), _children.count())));
if (_parent) {
_geom.setLeft(_parent->geometry().left() + int(_aspect.x * _parent->geometry().width()));
@@ -987,4 +992,7 @@ void KstViewObject::updateFromAspect() {
_geom.setBottom(_parent->geometry().top() + int((_aspect.y + _aspect.h) * _parent->geometry().height()) - 1);
}
+ if (_geom.width() >= _minimumSize.width() || _geom.height() >= _minimumSize.height()) {
+ _geom.setSize(_geom.size().expandedTo(_minimumSize));
+ }
assert(_geom.left() >= 0 && _geom.top() >= 0);
}
@@ -1275,4 +1283,14 @@ const QString& KstViewObject::type() con
}
+
+void KstViewObject::setMinimumSize(const QSize& sz) {
+ _minimumSize = sz.expandedTo(QSize(3, 3)); // 3,3 is the absolute minimum
+}
+
+
+const QSize& KstViewObject::minimumSize() const {
+ return _minimumSize;
+}
+
#include "kstviewobject.moc"
// vim: ts=2 sw=2 et
--- kdeextragear-2/kst/kst/kstviewobject.h #1.95:1.96
@@ -181,4 +181,7 @@ class KstViewObject : public KstObject {
virtual QString menuTitle() const;
+ void setMinimumSize(const QSize& sz);
+ const QSize& minimumSize() const;
+
public slots:
virtual void paint(KstPaintType type, QPainter& p);
@@ -238,4 +241,5 @@ class KstViewObject : public KstObject {
QMap<int, QString> _moveToMap;
QMap<int, QString> _copyToMap;
+ QSize _minimumSize;
};
More information about the Kst
mailing list