[Kde-bindings] playground/bindings/kimono

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sun Jan 21 18:23:45 UTC 2007


SVN commit 625956 by rdale:

* Added a QVariant.FromValue() method
* Removed QTextCodecPlugin.cs
* Fixed build error in QSysInfo.cs

CCMAIL: kde-bindings at kde.org



 M  +3 -0      ChangeLog  
 M  +1 -1      core/QSysInfo.cs  
 D             core/QTextCodecPlugin.cs  
 M  +48 -2     core/QVariantExtras.cs  


--- trunk/playground/bindings/kimono/ChangeLog #625955:625956
@@ -10,6 +10,9 @@
 	  methods.
 	* Fixed parsing in for Q_PROPERTY which meant that some methods in 
 	  QToolBar.cs were lost.
+	* Added a QVariant.FromValue() method
+	* Removed QTextCodecPlugin.cs
+	* Fixed build error in QSysInfo.cs
 
 2007-17-01  Arno Rehn  <arno at arnorehn.de>
 
--- trunk/playground/bindings/kimono/core/QSysInfo.cs #625955:625956
@@ -29,7 +29,7 @@
 		}
 
 		public enum Sizes {
-			WordSize = (sizeof(void*)<<3),
+			WordSize = (4<<3),
 		}
 		public enum Endian {
 			BigEndian = 0,
--- trunk/playground/bindings/kimono/core/QVariantExtras.cs #625955:625956
@@ -57,8 +57,54 @@
 			}
 		}
 
-		static public QVariant FromValue<T>() {
-			return new QVariant();
+		static public QVariant FromValue<T>(object value) {
+			if (typeof(T) == typeof(bool)) {
+				return new QVariant((bool) value);
+			} else if (typeof(T) == typeof(double)) {
+				return new QVariant((double) value);
+			} else if (typeof(T) == typeof(QByteArray)) {
+				return new QVariant((QByteArray) value);
+			} else if (typeof(T) == typeof(char)) {
+				return new QVariant((char) value);
+			} else if (typeof(T) == typeof(QDate)) {
+				return new QVariant((QDate) value);
+			} else if (typeof(T) == typeof(QDateTime)) {
+				return new QVariant((QDateTime) value);
+			} else if (typeof(T) == typeof(int)) {
+				return new QVariant((int) value);
+			} else if (typeof(T) == typeof(QLine)) {
+				return new QVariant((QLine) value);
+			} else if (typeof(T) == typeof(QLineF)) {
+				return new QVariant((QLineF) value);
+			} else if (typeof(T) == typeof(QLocale)) {
+				return new QVariant((QLocale) value);
+			} else if (typeof(T) == typeof(QPoint)) {
+				return new QVariant((QPoint) value);
+			} else if (typeof(T) == typeof(QPointF)) {
+				return new QVariant((QPointF) value);
+			} else if (typeof(T) == typeof(QRect)) {
+				return new QVariant((QRect) value);
+			} else if (typeof(T) == typeof(QRectF)) {
+				return new QVariant((QRectF) value);
+			} else if (typeof(T) == typeof(QRegExp)) {
+				return new QVariant((QRegExp) value);
+			} else if (typeof(T) == typeof(QSize)) {
+				return new QVariant((QSize) value);
+			} else if (typeof(T) == typeof(QSizeF)) {
+				return new QVariant((QSizeF) value);
+			} else if (typeof(T) == typeof(string)) {
+				return new QVariant((string) value);
+			} else if (typeof(T) == typeof(List<string>)) {
+				return new QVariant((ArrayList) value);
+			} else if (typeof(T) == typeof(QTime)) {
+				return new QVariant((QTime) value);
+			} else if (typeof(T) == typeof(uint)) {
+				return new QVariant((uint) value);
+			} else if (typeof(T) == typeof(QUrl)) {
+				return new QVariant((QUrl) value);
+			} else {
+				return new QVariant();
+			}
 		}
 	}
 }
\ No newline at end of file



More information about the Kde-bindings mailing list