[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kexi/plugins/tables (silent)
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2006-09-14 22:57:19
Message-ID: 1158274639.664355.29691.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 584471 by staniek:

SVN_SILENT support for double type of defaultValue (casting)


 M  +13 -2     kexitabledesignerview.cpp  


--- trunk/koffice/kexi/plugins/tables/kexitabledesignerview.cpp #584470:584471
@@ -68,6 +68,15 @@
 
 using namespace KexiTableDesignerCommands;
 
+//! @internal Used in tryCastQVariant() anf canCastQVariant()
+static bool isIntegerQVariant(QVariant::Type t)
+{
+	return t==QVariant::LongLong 
+		|| t==QVariant::ULongLong
+		|| t==QVariant::Int
+		|| t==QVariant::UInt;
+}
+
 //! @internal Used in tryCastQVariant()
 static bool canCastQVariant(QVariant::Type fromType, QVariant::Type toType)
 {
@@ -75,7 +84,7 @@
    || (fromType==QVariant::CString && toType==QVariant::String)
    || (fromType==QVariant::LongLong && toType==QVariant::ULongLong)
    || ((fromType==QVariant::String || fromType==QVariant::CString) 
-	      && (toType==QVariant::LongLong || toType==QVariant::ULongLong || \
toType==QVariant::Int || toType==QVariant::UInt)); +	      && \
(isIntegerQVariant(toType) || toType==QVariant::Double));  }
 
 /*! @internal 
@@ -87,7 +96,9 @@
 	const QVariant::Type fromType = fromVal.type();
 	if (fromType == toType)
 		return fromVal;
-	if (canCastQVariant(fromType, toType) || canCastQVariant(toType, fromType)) {
+	if (canCastQVariant(fromType, toType) || canCastQVariant(toType, fromType)
+	    || (isIntegerQVariant(fromType) && toType==QVariant::Double))
+	{
 		QVariant res( fromVal );
 		if (res.cast(toType))
 			return res;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic