Skip to content

Commit 622e2d1

Browse files
committed
Set focus to first widget on attribute form
1 parent ad5aa30 commit 622e2d1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/gui/qgsattributedialog.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,5 @@ void QgsAttributeDialog::init( QgsVectorLayer* layer, QgsFeature* feature, QgsAt
107107
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
108108
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
109109
restoreGeometry();
110+
focusNextChild();
110111
}

src/gui/qgsattributeform.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ void QgsAttributeForm::init()
371371
scrollArea->setWidgetResizable( true );
372372
scrollArea->setFrameShape( QFrame::NoFrame );
373373
scrollArea->setFrameShadow( QFrame::Plain );
374+
scrollArea->setFocusProxy( this );
374375
layout()->addWidget( scrollArea );
375376

376377
int row = 0;
@@ -678,12 +679,22 @@ void QgsAttributeForm::createWrappers()
678679

679680
void QgsAttributeForm::connectWrappers()
680681
{
682+
bool isFirstEww = true;
683+
681684
Q_FOREACH( QgsWidgetWrapper* ww, mWidgets )
682685
{
683686
QgsEditorWidgetWrapper* eww = qobject_cast<QgsEditorWidgetWrapper*>( ww );
684687

685688
if ( eww )
689+
{
690+
if ( isFirstEww )
691+
{
692+
setFocusProxy( eww->widget() );
693+
isFirstEww = false;
694+
}
695+
686696
connect( eww, SIGNAL( valueChanged( const QVariant& ) ), this, SLOT( onAttributeChanged( const QVariant& ) ) );
697+
}
687698
}
688699
}
689700

0 commit comments

Comments
 (0)