mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
The search widget wrappers for relations have two issues
* They recursively load whatever relations are defined. With self-referencing this leads to 💀
This is addressed by only loading one level of relations in search widgets.
* They would load even when hidden, leading to long load times on attribute table opening.
We now only actually load the form on the show event
44 lines
1.8 KiB
C++
44 lines
1.8 KiB
C++
/***************************************************************************
|
|
qgsattributeformrelationeditorwidget.cpp
|
|
--------------------------------------
|
|
Date : Nov 2017
|
|
Copyright : (C) 2017 Matthias Kuhn
|
|
Email : matthias@opengis.ch
|
|
***************************************************************************
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#include "qgsattributeformrelationeditorwidget.h"
|
|
#include "qgsrelationaggregatesearchwidgetwrapper.h"
|
|
#include "qgsattributeform.h"
|
|
|
|
#include "qgsrelationwidgetwrapper.h"
|
|
|
|
QgsAttributeFormRelationEditorWidget::QgsAttributeFormRelationEditorWidget( QgsRelationWidgetWrapper *wrapper, QgsAttributeForm *form )
|
|
: QgsAttributeFormWidget( wrapper, form )
|
|
, mWrapper( wrapper )
|
|
{
|
|
setSearchWidgetToolButtonVisible( false );
|
|
}
|
|
|
|
void QgsAttributeFormRelationEditorWidget::createSearchWidgetWrappers( const QgsAttributeEditorContext &context )
|
|
{
|
|
if ( context.parentContext() )
|
|
{
|
|
mSearchWidget = new QgsRelationAggregateSearchWidgetWrapper( layer(), mWrapper, form() );
|
|
mSearchWidget->setContext( context );
|
|
|
|
setSearchWidgetWrapper( mSearchWidget );
|
|
}
|
|
}
|
|
|
|
QString QgsAttributeFormRelationEditorWidget::currentFilterExpression() const
|
|
{
|
|
return mSearchWidget->expression();
|
|
}
|