File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,11 @@ void QgsFieldExpressionWidget::setField( const QString &fieldName )
190
190
return ;
191
191
}
192
192
193
+ if ( fieldName.size () > mCombo ->lineEdit ()->maxLength () )
194
+ {
195
+ mCombo ->lineEdit ()->setMaxLength ( fieldName.size () );
196
+ }
197
+
193
198
QModelIndex idx = mFieldProxyModel ->sourceFieldModel ()->indexFromName ( fieldName );
194
199
if ( !idx.isValid () )
195
200
{
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class TestQgsFieldExpressionWidget : public QObject
49
49
void testIsValid ();
50
50
void testFilters ();
51
51
void setNull ();
52
+ void testVeryLongExpression ();
52
53
53
54
private:
54
55
QgsFieldExpressionWidget *mWidget = nullptr ;
@@ -372,5 +373,19 @@ void TestQgsFieldExpressionWidget::setNull()
372
373
QgsProject::instance ()->removeMapLayer ( layer );
373
374
}
374
375
376
+ void TestQgsFieldExpressionWidget::testVeryLongExpression ()
377
+ {
378
+ QString veryLongExpression;
379
+ for ( int i = 0 ; i < 32770 ; i++ )
380
+ {
381
+ veryLongExpression += " a" ;
382
+ }
383
+
384
+ mWidget ->setExpression ( veryLongExpression );
385
+ QCOMPARE ( veryLongExpression.size (), mWidget ->currentText ().size () );
386
+ };
387
+
388
+
389
+
375
390
QGSTEST_MAIN ( TestQgsFieldExpressionWidget )
376
391
#include " testqgsfieldexpressionwidget.moc"
You can’t perform that action at this time.
0 commit comments