[Kst] branches/work/kst/portto4/kst/src/libkstapp
Peter Kümmel
syntheticpp at gmx.net
Thu Sep 2 16:36:27 CEST 2010
SVN commit 1171049 by kuemmel:
reenable QObject's parent
M +9 -10 viewitem.cpp
M +3 -2 viewitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1171048:1171049
@@ -47,7 +47,7 @@
// Don't mix QObject and QGraphicItem ownership
// Enabling the macro could have bad side effects, we will see.
// TODO check for memory leaks when enabled.
-#define KST_DISBALE_QOBJECT_PARENT
+//#define KST_DISBALE_QOBJECT_PARENT
namespace Kst {
@@ -406,13 +406,17 @@
}
View *ViewItem::parentView() const {
+#ifdef KST_DISBALE_QOBJECT_PARENT
return _parentView;
+#else
+ return qobject_cast<View*>(QObject::parent());
+#endif
}
void ViewItem::setParentView(View* parentView) {
_parentView = parentView;
#ifndef KST_DISBALE_QOBJECT_PARENT
- parentView()->setParent(parent);
+ QObject::setParent(parentView);
#endif
reRegisterShortcut();
updateRelativeSize();
@@ -430,11 +434,6 @@
}
-void ViewItem::setParent(ViewItem* parent) {
- setParentViewItem(parent);
-}
-
-
ViewItem::GripMode ViewItem::gripMode() const {
return _gripMode;
}
@@ -1442,7 +1441,7 @@
<< endl;
#endif
- setParent(0);
+ setParentView(0);
setPos(mapToParent(mapFromScene(origin)) + pos() - mapToParent(QPointF(0,0)));
updateRelativeSize();
@@ -1494,7 +1493,7 @@
<< endl;
#endif
- setParent(viewItem);
+ setParentViewItem(viewItem);
setPos(mapToParent(mapFromScene(origin)) + pos() - mapToParent(QPointF(0,0)));
updateRelativeSize();
@@ -1526,7 +1525,7 @@
<< endl;
#endif
- setParent(0);
+ setParentView(0);
setPos(mapToParent(mapFromScene(origin)) + pos() - mapToParent(QPointF(0,0)));
updateRelativeSize();
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1171048:1171049
@@ -320,8 +320,9 @@
View *_parentView;
- // use void setParentViewItem(ViewItem *parent);
- void setParent(ViewItem *parent);
+ // use void setParentView(View *parent);
+ QObject* parent() const;
+ void setParent(QObject*);
friend class View;
friend class Scene;
More information about the Kst
mailing list