[Kde-bindings] playground/bindings/kimono

Arno Rehn kde at arnorehn.de
Sat Mar 3 11:59:26 UTC 2007


SVN commit 638799 by arnorehn:

* Added QModelIndex.InternalPointer() and QAbstractItemModel.CreateIndex()
* Added simpletreemodel example (doesn't fully work yet)
* Fixed invocation of methods with an enum as a argument

CCMAIL: kde-bindings at kde.org



 M  +6 -0      ChangeLog  
 M  +3 -3      SmokeInvocation.cs  
 M  +1 -1      core/QAbstractItemModel.cs  
 A             core/QAbstractItemModelExtras.cs  
 M  +1 -1      core/QModelIndex.cs  
 A             core/QModelIndexExtras.cs  
 M  +1 -0      examples/CMakeLists.txt  
 A             examples/itemviews (directory)  
 A             examples/itemviews/CMakeLists.txt  
 A             examples/itemviews/simpletreemodel (directory)  
 A             examples/itemviews/simpletreemodel/CMakeLists.txt  
 A             examples/itemviews/simpletreemodel/default.txt  
 A             examples/itemviews/simpletreemodel/main.cs  
 A             examples/itemviews/simpletreemodel/simpletreemodel.qrc  
 A             examples/itemviews/simpletreemodel/treeitem.cs  
 A             examples/itemviews/simpletreemodel/treemodel.cs  
 M  +39 -0     qyoto.cpp  


--- trunk/playground/bindings/kimono/ChangeLog #638798:638799
@@ -1,3 +1,9 @@
+2007-03-03  Arno Rehn  <arno at arnorehn.de>
+
+	* Added QModelIndex.InternalPointer() and QAbstractItemModel.CreateIndex()
+	* Added simpletreemodel example (doesn't fully work yet)
+	* Fixed invocation of methods with an enum as a argument
+
 2007-02-28  Arno Rehn  <arno at arnorehn.de>
 
 	* Don't include inherited signals/slots when building up the metaobject
--- trunk/playground/bindings/kimono/SmokeInvocation.cs #638798:638799
@@ -177,10 +177,10 @@
 						args[i] = stackPtr[i].s_short;
 					} else if (parameters[i].ParameterType == typeof(ushort)) {
 						args[i] = stackPtr[i].s_ushort;
-					} else if (	parameters[i].ParameterType == typeof(int) 
-								|| parameters[i].ParameterType.IsEnum ) 
-					{
+					} else if (parameters[i].ParameterType == typeof(int)) {
 						args[i] = stackPtr[i].s_int;
+					} else if (parameters[i].ParameterType.IsEnum) {
+						args[i] = Enum.ToObject(parameters[i].ParameterType, stackPtr[i].s_int);
 					} else if (parameters[i].ParameterType == typeof(uint)) {
 						args[i] = stackPtr[i].s_uint;
 					} else if (parameters[i].ParameterType == typeof(long)) {
--- trunk/playground/bindings/kimono/core/QAbstractItemModel.cs #638798:638799
@@ -6,7 +6,7 @@
 
 	/// See <see cref="IQAbstractItemModelSignals"></see> for signals emitted by QAbstractItemModel
 	[SmokeClass("QAbstractItemModel")]
-	public class QAbstractItemModel : QObject {
+	public partial class QAbstractItemModel : QObject {
  		protected QAbstractItemModel(Type dummy) : base((Type) null) {}
 		[SmokeClass("QAbstractItemModel")]
 		interface IQAbstractItemModelProxy {
--- trunk/playground/bindings/kimono/core/QModelIndex.cs #638798:638799
@@ -4,7 +4,7 @@
 	using System;
 
 	[SmokeClass("QModelIndex")]
-	public class QModelIndex : MarshalByRefObject, IDisposable {
+	public partial class QModelIndex : MarshalByRefObject, IDisposable {
 		protected Object _interceptor = null;
 		private IntPtr _smokeObject;
 		protected QModelIndex(Type dummy) {}
--- trunk/playground/bindings/kimono/examples/CMakeLists.txt #638798:638799
@@ -2,5 +2,6 @@
 ADD_SUBDIRECTORY(qdbus)
 ADD_SUBDIRECTORY(tutorial)
 ADD_SUBDIRECTORY(widgets)
+ADD_SUBDIRECTORY(itemviews)
 
 
--- trunk/playground/bindings/kimono/qyoto.cpp #638798:638799
@@ -28,6 +28,7 @@
 #include <QtCore/qregexp.h>
 #include <QtCore/qstringlist.h>
 #include <QMetaMethod>
+#include <QModelIndex>
 
 #undef DEBUG
 #ifndef __USE_POSIX
@@ -1189,6 +1190,7 @@
 	for(int i = 0; i < list->size(); ++i) {
 		(*addFn)(list->at(i));
 	}
+	(*FreeGCHandle)(parent);
 }
 
 /* Adapted from the internal function qt_qFindChild() in qobject.cpp */
@@ -1227,6 +1229,7 @@
 	QString name = QString::fromUtf8(childName);
 	
 	QMetaObject * mo = parent_meta_object(parent);
+	(*FreeGCHandle)(parent);
 	return cs_qFindChildHelper(parent, name, *mo);
 }
 
@@ -1259,6 +1262,42 @@
 	return set_obj_info("Qyoto.QVariant", vo);
 }
 
+void *
+ModelIndexInternalPointer(void *obj)
+{
+	smokeqyoto_object *o = value_obj_info(obj);
+	QModelIndex *modelIndex = (QModelIndex*) o->ptr;
+	void *ptr = modelIndex->internalPointer();
+	return ptr;
+}
+
+void *
+AbstractItemModelCreateIndex(void* obj, int row, int column, void *ptr)
+{
+	smokeqyoto_object *o = value_obj_info(obj);
+	
+	Smoke::Index method = FindMethodId("QAbstractItemModel", "createIndex$$$", "(int, int, void*) const");
+	if (method == -1) {
+		return 0;
+	}
+	Smoke::Method &methodId = o->smoke->methods[method];
+	Smoke::ClassFn fn = o->smoke->classes[methodId.classId].classFn;
+	Smoke::StackItem i[4];
+	i[1].s_int = row;
+	i[2].s_int = column;
+	i[3].s_voidp = ptr;
+	(*fn)(methodId.method, o->ptr, i);
+	
+	if (i[0].s_voidp == 0) {
+		return 0;
+	}
+	
+	int id = o->smoke->idClass("QModelIndex");
+	smokeqyoto_object *ret = alloc_smokeqyoto_object(true, o->smoke, id, i[0].s_voidp);
+	(*FreeGCHandle)(obj);
+	return set_obj_info("Qyoto.QModelIndex", ret);
+}
+
 bool QyotoRegisterResourceData(int flag, const unsigned char * s, const unsigned char *n, const unsigned char *d)
 {
 	qRegisterResourceData(flag, s, n, d);



More information about the Kde-bindings mailing list