Skip to content

Commit

Permalink
Set focus to first widget on attribute form
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jul 23, 2014
1 parent ad5aa30 commit 622e2d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/gui/qgsattributedialog.cpp
Expand Up @@ -107,4 +107,5 @@ void QgsAttributeDialog::init( QgsVectorLayer* layer, QgsFeature* feature, QgsAt
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
restoreGeometry();
focusNextChild();
}
11 changes: 11 additions & 0 deletions src/gui/qgsattributeform.cpp
Expand Up @@ -371,6 +371,7 @@ void QgsAttributeForm::init()
scrollArea->setWidgetResizable( true );
scrollArea->setFrameShape( QFrame::NoFrame );
scrollArea->setFrameShadow( QFrame::Plain );
scrollArea->setFocusProxy( this );
layout()->addWidget( scrollArea );

int row = 0;
Expand Down Expand Up @@ -678,12 +679,22 @@ void QgsAttributeForm::createWrappers()

void QgsAttributeForm::connectWrappers()
{
bool isFirstEww = true;

Q_FOREACH( QgsWidgetWrapper* ww, mWidgets )
{
QgsEditorWidgetWrapper* eww = qobject_cast<QgsEditorWidgetWrapper*>( ww );

if ( eww )
{
if ( isFirstEww )
{
setFocusProxy( eww->widget() );
isFirstEww = false;
}

connect( eww, SIGNAL( valueChanged( const QVariant& ) ), this, SLOT( onAttributeChanged( const QVariant& ) ) );
}
}
}

Expand Down

0 comments on commit 622e2d1

Please sign in to comment.