[QGIS Commit] r14006 - in trunk/qgis/src: app gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Aug 4 10:45:09 EDT 2010


Author: mhugent
Date: 2010-08-04 14:45:09 +0000 (Wed, 04 Aug 2010)
New Revision: 14006

Modified:
   trunk/qgis/src/app/qgsattributedialog.cpp
   trunk/qgis/src/gui/qgsattributeeditor.cpp
Log:
Support for long int in attribute dialog and editor. Fixes bug #2928

Modified: trunk/qgis/src/app/qgsattributedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributedialog.cpp	2010-08-04 11:13:52 UTC (rev 14005)
+++ trunk/qgis/src/app/qgsattributedialog.cpp	2010-08-04 14:45:09 UTC (rev 14006)
@@ -146,6 +146,10 @@
       {
         mypLabel->setText( myFieldName + tr( " (dbl)" ) );
       }
+      else if ( myFieldType == QVariant::LongLong )
+      {
+        mypLabel->setText( myFieldName + tr( " (long)" ) );
+      }
       else //string
       {
         //any special behaviour for string goes here

Modified: trunk/qgis/src/gui/qgsattributeeditor.cpp
===================================================================
--- trunk/qgis/src/gui/qgsattributeeditor.cpp	2010-08-04 11:13:52 UTC (rev 14005)
+++ trunk/qgis/src/gui/qgsattributeeditor.cpp	2010-08-04 14:45:09 UTC (rev 14006)
@@ -354,7 +354,7 @@
           le->setCompleter( c );
         }
 
-        if ( myFieldType == QVariant::Int )
+        if ( myFieldType == QVariant::Int || myFieldType == QVariant::LongLong )
         {
           le->setValidator( new QIntValidator( le ) );
         }
@@ -545,6 +545,20 @@
       }
     }
     break;
+    case QVariant::LongLong:
+    {
+      bool ok;
+      qlonglong myLongValue = text.toLong( &ok );
+      if ( ok && !text.isEmpty() )
+      {
+        value = QVariant( myLongValue );
+        modified = true;
+      }
+      else if ( modified )
+      {
+        value = QVariant( theField.type() );
+      }
+    }
     case QVariant::Double:
     {
       bool ok;
@@ -668,7 +682,7 @@
 
       QString text;
       if ( value.isNull() )
-        if ( myFieldType == QVariant::Int || myFieldType == QVariant::Double )
+        if ( myFieldType == QVariant::Int || myFieldType == QVariant::Double || myFieldType == QVariant::LongLong )
           text = "";
         else
           text = "NULL";



More information about the QGIS-commit mailing list