mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-08 00:06:51 -05:00
[ui] Attributes form properties: Refresh right panel after changing layout mode to have the proper widgets displayed
This commit is contained in:
parent
ec649376a4
commit
cac4013a14
@ -80,8 +80,8 @@ QgsAttributesFormProperties::QgsAttributesFormProperties( QgsVectorLayer *layer,
|
||||
|
||||
connect( mAvailableWidgetsTreeView, &QWidget::customContextMenuRequested, this, &QgsAttributesFormProperties::onContextMenuRequested );
|
||||
|
||||
connect( mAddTabOrGroupButton, &QAbstractButton::clicked, this, &QgsAttributesFormProperties::addContainer );
|
||||
connect( mRemoveTabOrGroupButton, &QAbstractButton::clicked, this, &QgsAttributesFormProperties::removeTabOrGroupButton );
|
||||
connect( mAddContainerButton, &QAbstractButton::clicked, this, &QgsAttributesFormProperties::addContainer );
|
||||
connect( mRemoveLayoutItemButton, &QAbstractButton::clicked, this, &QgsAttributesFormProperties::removeTabOrGroupButton );
|
||||
connect( mInvertSelectionButton, &QAbstractButton::clicked, this, &QgsAttributesFormProperties::onInvertSelectionButtonClicked );
|
||||
connect( mShowAliasesButton, &QAbstractButton::toggled, this, &QgsAttributesFormProperties::toggleShowAliases );
|
||||
connect( mEditorLayoutComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsAttributesFormProperties::mEditorLayoutComboBox_currentIndexChanged );
|
||||
@ -556,7 +556,7 @@ void QgsAttributesFormProperties::loadAttributeSpecificEditor( QgsAttributesForm
|
||||
}
|
||||
else
|
||||
{
|
||||
loadInfoWidget( tr( "This configuration is available with double-click" ) );
|
||||
loadInfoWidget( tr( "This configuration is available with double-click in the Form Layout panel" ) );
|
||||
}
|
||||
receiver->clearSelection();
|
||||
break;
|
||||
@ -652,34 +652,55 @@ void QgsAttributesFormProperties::removeTabOrGroupButton()
|
||||
|
||||
void QgsAttributesFormProperties::mEditorLayoutComboBox_currentIndexChanged( int )
|
||||
{
|
||||
// Refresh the right panel. Save selection to recover it later.
|
||||
const QItemSelection selection = mAvailableWidgetsTreeView->selectionModel()->selection();
|
||||
if ( selection.count() > 0 )
|
||||
{
|
||||
mAvailableWidgetsTreeView->selectionModel()->clear();
|
||||
}
|
||||
|
||||
if ( mFormLayoutTreeView->selectionModel()->selectedRows().count() > 0 )
|
||||
{
|
||||
mFormLayoutTreeView->selectionModel()->clear(); // Get rid of e.g., container selection
|
||||
}
|
||||
|
||||
const Qgis::AttributeFormLayout layout = mEditorLayoutComboBox->currentData().value<Qgis::AttributeFormLayout>();
|
||||
switch ( layout )
|
||||
{
|
||||
case Qgis::AttributeFormLayout::AutoGenerated:
|
||||
mFormLayoutWidget->setVisible( false );
|
||||
mUiFileFrame->setVisible( false );
|
||||
mAddTabOrGroupButton->setVisible( false );
|
||||
mRemoveTabOrGroupButton->setVisible( false );
|
||||
mAddContainerButton->setVisible( false );
|
||||
mRemoveLayoutItemButton->setVisible( false );
|
||||
mInvertSelectionButton->setVisible( false );
|
||||
mShowAliasesButton->setVisible( false );
|
||||
break;
|
||||
|
||||
case Qgis::AttributeFormLayout::DragAndDrop:
|
||||
mFormLayoutWidget->setVisible( true );
|
||||
mUiFileFrame->setVisible( false );
|
||||
mAddTabOrGroupButton->setVisible( true );
|
||||
mRemoveTabOrGroupButton->setVisible( true );
|
||||
mAddContainerButton->setVisible( true );
|
||||
mRemoveLayoutItemButton->setVisible( true );
|
||||
mInvertSelectionButton->setVisible( true );
|
||||
mShowAliasesButton->setVisible( true );
|
||||
break;
|
||||
|
||||
case Qgis::AttributeFormLayout::UiFile:
|
||||
// ui file
|
||||
mFormLayoutWidget->setVisible( false );
|
||||
mUiFileFrame->setVisible( true );
|
||||
mAddTabOrGroupButton->setVisible( false );
|
||||
mRemoveTabOrGroupButton->setVisible( false );
|
||||
mAddContainerButton->setVisible( false );
|
||||
mRemoveLayoutItemButton->setVisible( false );
|
||||
mInvertSelectionButton->setVisible( false );
|
||||
mShowAliasesButton->setVisible( false );
|
||||
break;
|
||||
}
|
||||
|
||||
// Get the selection back so that we refresh the right panel
|
||||
if ( selection.count() > 0 )
|
||||
{
|
||||
mAvailableWidgetsTreeView->selectionModel()->select( selection, QItemSelectionModel::Select );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsAttributesFormProperties::mTbInitCode_clicked()
|
||||
|
||||
@ -170,7 +170,7 @@ Use this function to add extra logic to your forms.</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="mRemoveTabOrGroupButton">
|
||||
<widget class="QToolButton" name="mRemoveLayoutItemButton">
|
||||
<property name="toolTip">
|
||||
<string>Remove selected item(s) from the form layout</string>
|
||||
</property>
|
||||
@ -184,7 +184,7 @@ Use this function to add extra logic to your forms.</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="mAddTabOrGroupButton">
|
||||
<widget class="QToolButton" name="mAddContainerButton">
|
||||
<property name="toolTip">
|
||||
<string>Add a new tab or group to the form layout</string>
|
||||
</property>
|
||||
@ -276,8 +276,8 @@ Use this function to add extra logic to your forms.</string>
|
||||
<tabstop>mFormSuppressCmbBx</tabstop>
|
||||
<tabstop>mEditFormLineEdit</tabstop>
|
||||
<tabstop>pbnSelectEditForm</tabstop>
|
||||
<tabstop>mAddTabOrGroupButton</tabstop>
|
||||
<tabstop>mRemoveTabOrGroupButton</tabstop>
|
||||
<tabstop>mAddContainerButton</tabstop>
|
||||
<tabstop>mRemoveLayoutItemButton</tabstop>
|
||||
<tabstop>mInvertSelectionButton</tabstop>
|
||||
<tabstop>mShowAliasesButton</tabstop>
|
||||
<tabstop>scrollArea_2</tabstop>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user