Skip to content

Commit 3828f22

Browse files
committed
fix #4305
1 parent 90edf36 commit 3828f22

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/gui/qgsquerybuilder.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ void QgsQueryBuilder::fillValues( int idx, int limit )
103103
{
104104
QStandardItem *myItem = new QStandardItem( values[i].toString() );
105105
myItem->setEditable( false );
106+
myItem->setData( values[i] );
106107
mModelValues->insertRow( mModelValues->rowCount(), myItem );
107108
}
108109
}
@@ -266,7 +267,13 @@ void QgsQueryBuilder::on_lstFields_doubleClicked( const QModelIndex &index )
266267

267268
void QgsQueryBuilder::on_lstValues_doubleClicked( const QModelIndex &index )
268269
{
269-
txtSQL->insertPlainText( "'" + mModelValues->data( index ).toString() + "'" );
270+
QVariant value = mModelValues->data( index, Qt::UserRole + 1 );
271+
if( value.isNull() )
272+
txtSQL->insertPlainText( "NULL" );
273+
else if( value.type() == QVariant::Int || value.type() == QVariant::Double || value.type() == QVariant::LongLong )
274+
txtSQL->insertPlainText( value.toString() );
275+
else
276+
txtSQL->insertPlainText( "'" + value.toString() + "'" );
270277
}
271278

272279
void QgsQueryBuilder::on_btnLessEqual_clicked()

0 commit comments

Comments
 (0)