[rkward-cvs] SF.net SVN: rkward: [2188] branches/KDE4_port/rkward/core
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Nov 8 13:05:31 UTC 2007
Revision: 2188
http://rkward.svn.sourceforge.net/rkward/?rev=2188&view=rev
Author: tfry
Date: 2007-11-08 05:05:31 -0800 (Thu, 08 Nov 2007)
Log Message:
-----------
Documentation and a small correction
Modified Paths:
--------------
branches/KDE4_port/rkward/core/rkmodificationtracker.cpp
branches/KDE4_port/rkward/core/rkmodificationtracker.h
branches/KDE4_port/rkward/core/rkvariable.cpp
branches/KDE4_port/rkward/core/rkvariable.h
Modified: branches/KDE4_port/rkward/core/rkmodificationtracker.cpp
===================================================================
--- branches/KDE4_port/rkward/core/rkmodificationtracker.cpp 2007-11-08 13:04:53 UTC (rev 2187)
+++ branches/KDE4_port/rkward/core/rkmodificationtracker.cpp 2007-11-08 13:05:31 UTC (rev 2188)
@@ -39,6 +39,7 @@
RK_TRACE (OBJECTS);
RK_ASSERT (updates_locked == 0);
+ RK_ASSERT (listeners.isEmpty ());
}
void RKModificationTracker::lockUpdates (bool lock) {
@@ -171,7 +172,7 @@
delete changes;
QModelIndex object_index = indexFor (object);
- emit (dataChanged (object_index, object_index));
+ emit (dataChanged (object_index, object_index)); // might have changed dimensions, for instance
}
}
@@ -179,7 +180,6 @@
RK_TRACE (OBJECTS);
listeners.insert (object, listener);
-#warning: probably we should create and check for an appropriate NotificationType, instead
if (listener->listenerType () == RObjectListener::DataModel) object->beginEdit ();
}
@@ -187,7 +187,6 @@
RK_TRACE (OBJECTS);
listeners.remove (object, listener);
-#warning: probably we should create and check for an appropriate NotificationType, instead
if (listener->listenerType () == RObjectListener::DataModel) object->endEdit ();
}
@@ -213,6 +212,17 @@
RK_ASSERT (false);
}
}
+
+ // when a container is removed, we need to send child notifications recursively, so listeners listening
+ // for child objects will know the object is gone.
+ if (type == RObjectListener::ObjectRemoved) {
+ if (o->isContainer ()) {
+ RContainerObject *c = static_cast<RContainerObject*> (o);
+ for (int i = c->numChildren () - 1; i >= 0; --i) {
+ sendListenerNotification (RObjectListener::ObjectRemoved, c->findChildByIndex (i), 0, 0, 0);
+ }
+ }
+ }
}
RKEditor* RKModificationTracker::objectEditor (RObject* object) {
Modified: branches/KDE4_port/rkward/core/rkmodificationtracker.h
===================================================================
--- branches/KDE4_port/rkward/core/rkmodificationtracker.h 2007-11-08 13:04:53 UTC (rev 2187)
+++ branches/KDE4_port/rkward/core/rkmodificationtracker.h 2007-11-08 13:05:31 UTC (rev 2188)
@@ -51,15 +51,15 @@
virtual ~RObjectListener ();
friend class RKModificationTracker;
- /** reimplement this, if you are listening for an object with notification type ObjectRemoved. The default implementation does nothing and raises an assert */
+ /** reimplement this, if you are listening for an object with notification type ObjectRemoved. The default implementation does nothing and raises an assert. This gets sent *before* the child is actually removed, so you can safely query it for information in this call, but directly after the pointer will become invalid. Make sure to call stopListenForObject(), when you receive this notification. */
virtual void objectRemoved (RObject* removed);
- /** reimplement this, if you are listening for an object with notification type ChildAdded. The default implementation does nothing and raises an assert */
+ /** reimplement this, if you are listening for an object with notification type ChildAdded. The default implementation does nothing and raises an assert. This notification is sent *after* the child was added. */
virtual void childAdded (int index, RObject* parent);
- /** reimplement this, if you are listening for an object with notification type ChildMoved. The default implementation does nothing and raises an assert. The child is to be found at new_index at the time the notification is sent. */
+ /** reimplement this, if you are listening for an object with notification type ChildMoved. The default implementation does nothing and raises an assert. This notification is sent *after* the child was moved, so it is now at the new_index. */
virtual void childMoved (int old_index, int new_index, RObject* parent);
- /** reimplement this, if you are listening for an object with notification type MetaChanged. The default implementation does nothing and raises an assert */
+ /** reimplement this, if you are listening for an object with notification type MetaChanged. The default implementation does nothing and raises an assert. This notification is sent *after* the object has changed. */
virtual void objectMetaChanged (RObject* changed);
- /** reimplement this, if you are listening for an object with notification type DataChanged. The default implementation does nothing and raises an assert */
+ /** reimplement this, if you are listening for an object with notification type DataChanged. The default implementation does nothing and raises an assert. This notification is sent *after* the object has changed. */
virtual void objectDataChanged (RObject* object, const RObject::ChangeSet *changes);
void listenForObject (RObject* object);
Modified: branches/KDE4_port/rkward/core/rkvariable.cpp
===================================================================
--- branches/KDE4_port/rkward/core/rkvariable.cpp 2007-11-08 13:04:53 UTC (rev 2187)
+++ branches/KDE4_port/rkward/core/rkvariable.cpp 2007-11-08 13:05:31 UTC (rev 2188)
@@ -524,6 +524,7 @@
}
}
+#warning this could/should be merged with setCharacter (which is currently less complete)
void RKVariable::setText (int row, const QString &text) {
RK_TRACE (OBJECTS);
RK_ASSERT (row < getLength ());
Modified: branches/KDE4_port/rkward/core/rkvariable.h
===================================================================
--- branches/KDE4_port/rkward/core/rkvariable.h 2007-11-08 13:04:53 UTC (rev 2187)
+++ branches/KDE4_port/rkward/core/rkvariable.h 2007-11-08 13:05:31 UTC (rev 2188)
@@ -73,7 +73,7 @@
double *getNumeric (int from_row, int to_row) const;
/** set numeric values in the given range. Assumes you provide enough values for the range. If internalStorage is String, all values will be converted to strings, so you should use this function only, if you know you are dealing with a numeric object */
void setNumeric (int from_row, int to_row, double *data);
-/** like getNumeric, but returns values as an array of QString*s. TODO: unused */
+/** like getNumeric, but returns values as an array of QStrings. TODO: unused */
QString *getCharacter (int from_row, int to_row) const;
/** like setNumeric, but sets chars. If internalStorage () is numeric, attempts to convert the given strings to numbers. I.e. the function behaves essentially like setText (), but operates on a range of cells. */
void setCharacter (int from_row, int to_row, QString *data);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list