Skip to content
Permalink
Browse files

Merge pull request #4942 from gacarrillor/relation_reference_widget_f…

…ixes

[needs-docs] Relation Reference Widget: Add option to show/hide Open Form Button
  • Loading branch information
m-kuhn committed Jul 30, 2017
2 parents f6b8426 + 91e39a7 commit cf753e9ff4778d62b632b88f203b8e3285b06677
@@ -44,6 +44,7 @@ QgsRelationReferenceConfigDlg::QgsRelationReferenceConfigDlg( QgsVectorLayer *vl
connect( mCbxAllowNull, &QAbstractButton::toggled, this, &QgsEditorConfigWidget::changed );
connect( mCbxOrderByValue, &QAbstractButton::toggled, this, &QgsEditorConfigWidget::changed );
connect( mCbxShowForm, &QAbstractButton::toggled, this, &QgsEditorConfigWidget::changed );
connect( mCbxShowOpenFormButton, &QAbstractButton::toggled, this, &QgsEditorConfigWidget::changed );
connect( mCbxMapIdentification, &QAbstractButton::toggled, this, &QgsEditorConfigWidget::changed );
connect( mCbxReadOnly, &QAbstractButton::toggled, this, &QgsEditorConfigWidget::changed );
connect( mComboRelation, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsEditorConfigWidget::changed );
@@ -59,6 +60,7 @@ void QgsRelationReferenceConfigDlg::setConfig( const QVariantMap &config )
mCbxAllowNull->setChecked( config.value( QStringLiteral( "AllowNULL" ), false ).toBool() );
mCbxOrderByValue->setChecked( config.value( QStringLiteral( "OrderByValue" ), false ).toBool() );
mCbxShowForm->setChecked( config.value( QStringLiteral( "ShowForm" ), false ).toBool() );
mCbxShowOpenFormButton->setChecked( config.value( QStringLiteral( "ShowOpenFormButton" ), true ).toBool() );

if ( config.contains( QStringLiteral( "Relation" ) ) )
{
@@ -121,6 +123,7 @@ QVariantMap QgsRelationReferenceConfigDlg::config()
myConfig.insert( QStringLiteral( "AllowNULL" ), mCbxAllowNull->isChecked() );
myConfig.insert( QStringLiteral( "OrderByValue" ), mCbxOrderByValue->isChecked() );
myConfig.insert( QStringLiteral( "ShowForm" ), mCbxShowForm->isChecked() );
myConfig.insert( QStringLiteral( "ShowOpenFormButton" ), mCbxShowOpenFormButton->isChecked() );
myConfig.insert( QStringLiteral( "MapIdentification" ), mCbxMapIdentification->isEnabled() && mCbxMapIdentification->isChecked() );
myConfig.insert( QStringLiteral( "ReadOnly" ), mCbxReadOnly->isChecked() );
myConfig.insert( QStringLiteral( "Relation" ), mComboRelation->currentData() );
@@ -50,11 +50,13 @@ void QgsRelationReferenceWidgetWrapper::initWidget( QWidget *editor )
bool mapIdent = config( QStringLiteral( "MapIdentification" ), false ).toBool();
bool readOnlyWidget = config( QStringLiteral( "ReadOnly" ), false ).toBool();
bool orderByValue = config( QStringLiteral( "OrderByValue" ), false ).toBool();
bool showOpenFormButton = config( QStringLiteral( "ShowOpenFormButton" ), true ).toBool();

mWidget->setEmbedForm( showForm );
mWidget->setReadOnlySelector( readOnlyWidget );
mWidget->setAllowMapIdentification( mapIdent );
mWidget->setOrderByValue( orderByValue );
mWidget->setOpenFormButtonVisible( showOpenFormButton );
if ( config( QStringLiteral( "FilterFields" ), QVariant() ).isValid() )
{
mWidget->setFilterFields( config( QStringLiteral( "FilterFields" ) ).toStringList() );
@@ -21,6 +21,13 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="mCbxShowOpenFormButton">
<property name="text">
<string>Show open form button</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mComboRelation"/>
</item>
@@ -31,7 +38,7 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="mCbxReadOnly">
<property name="text">
<string>Use a read-only line edit instead of a combobox</string>
@@ -59,7 +66,7 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="mCbxMapIdentification">
<property name="text">
<string>On map identification (for geometric layers only)</string>
@@ -73,7 +80,7 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<widget class="QgsCollapsibleGroupBox" name="mFilterGroupBox">
<property name="title">
<string>Filters</string>
@@ -152,7 +159,7 @@
</layout>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="mCbxAllowAddFeatures">
<property name="text">
<string>Allow adding new features</string>
@@ -181,6 +188,7 @@
<tabstop>mCbxAllowNull</tabstop>
<tabstop>mCbxOrderByValue</tabstop>
<tabstop>mCbxShowForm</tabstop>
<tabstop>mCbxShowOpenFormButton</tabstop>
<tabstop>mCbxMapIdentification</tabstop>
<tabstop>mCbxReadOnly</tabstop>
<tabstop>mCbxAllowAddFeatures</tabstop>

0 comments on commit cf753e9

Please sign in to comment.
You can’t perform that action at this time.