Skip to content
Permalink
Browse files
Support for long int in attribute dialog and editor. Fixes bug #2928
git-svn-id: http://svn.osgeo.org/qgis/trunk@14006 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 4, 2010
1 parent b452bb8 commit 32648f6ec6e2dde9cf289d2e329b4b620d7d7959
Showing with 20 additions and 2 deletions.
  1. +4 −0 src/app/qgsattributedialog.cpp
  2. +16 −2 src/gui/qgsattributeeditor.cpp
@@ -146,6 +146,10 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
{
mypLabel->setText( myFieldName + tr( " (dbl)" ) );
}
else if ( myFieldType == QVariant::LongLong )
{
mypLabel->setText( myFieldName + tr( " (long)" ) );
}
else //string
{
//any special behaviour for string goes here
@@ -354,7 +354,7 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
le->setCompleter( c );
}

if ( myFieldType == QVariant::Int )
if ( myFieldType == QVariant::Int || myFieldType == QVariant::LongLong )
{
le->setValidator( new QIntValidator( le ) );
}
@@ -545,6 +545,20 @@ bool QgsAttributeEditor::retrieveValue( QWidget *widget, QgsVectorLayer *vl, int
}
}
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 @@ bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx,

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";

0 comments on commit 32648f6

Please sign in to comment.