Skip to content

Commit

Permalink
Support for long int in attribute dialog and editor. Fixes bug #2928
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14006 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 4, 2010
1 parent 628a51a commit 4090e06
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/app/qgsattributedialog.cpp
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions src/gui/qgsattributeeditor.cpp
Expand Up @@ -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 ) );
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 4090e06

Please sign in to comment.