Skip to content
Permalink
Browse files
Set focus to first widget on attribute form
  • Loading branch information
m-kuhn committed Jul 23, 2014
1 parent ad5aa30 commit 622e2d14aba8eab9566b5e36d3c7cc9311d04bab
Showing with 12 additions and 0 deletions.
  1. +1 −0 src/gui/qgsattributedialog.cpp
  2. +11 −0 src/gui/qgsattributeform.cpp
@@ -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();
}
@@ -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;
@@ -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& ) ) );
}
}
}

0 comments on commit 622e2d1

Please sign in to comment.