[Kde-bindings] KDE/kdebindings/csharp/qyoto/src
Arno Rehn
kde at arnorehn.de
Fri Oct 23 20:39:35 UTC 2009
SVN commit 1039569 by arnorehn:
Don't garbage collect a QGraphicsScene if it's still visible in a view.
Only garbage collect QWidgets that are hidden and don't have a parent.
This should produce a more 'natural' behaviour for top-level widgets.
CCMAIL: kde-bindings at kde.org
M +8 -5 handlers.cpp
--- trunk/KDE/kdebindings/csharp/qyoto/src/handlers.cpp #1039568:1039569
@@ -406,15 +406,18 @@
if (item->treeWidget() != 0) {
return true;
}
+ } else if (o->smoke->isDerivedFromByName(className, "QGraphicsScene")) {
+ QGraphicsScene * scene = (QGraphicsScene *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QGraphicsScene").index);
+ if (scene->views().count() > 0 || scene->parent() != 0) {
+ return true;
+ }
} else if (o->smoke->isDerivedFromByName(className, "QWidget")) {
+ // Only garbage collect the widget if it's hidden, doesn't have any parents and if there are no more
+ // references to it in the code. This should produce a more 'natural' behaviour for top-level widgets.
QWidget * qwidget = (QWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QWidget").index);
- if (qwidget->parentWidget() != 0) {
+ if (qwidget->isVisible() || qwidget->parent() != 0) {
return true;
}
- // Don't garbage collect custom subclasses of QWidget classes for now
- const QMetaObject * meta = qwidget->metaObject();
- Smoke::ModuleIndex classId = o->smoke->idClass(meta->className());
- return (classId.index == 0);
} else if (o->smoke->isDerivedFromByName(className, "QObject")) {
QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
if (qobject->parent() != 0) {
More information about the Kde-bindings
mailing list