Skip to content
Permalink
Browse files

Merge pull request #9614 from elpaso/form-designer-allow-toggle-selec…

…tion

Toggle selection button in form d&d designer
  • Loading branch information
elpaso committed Mar 25, 2019
2 parents 4a43bba + eb64810 commit 1942507fe9a70363d15e027d260afed45c9680ce
@@ -66,6 +66,7 @@ QgsAttributesFormProperties::QgsAttributesFormProperties( QgsVectorLayer *layer,
connect( mAvailableWidgetsTree, &QTreeWidget::itemSelectionChanged, this, &QgsAttributesFormProperties::onAttributeSelectionChanged );
connect( mAddTabOrGroupButton, &QAbstractButton::clicked, this, &QgsAttributesFormProperties::addTabOrGroupButton );
connect( mRemoveTabOrGroupButton, &QAbstractButton::clicked, this, &QgsAttributesFormProperties::removeTabOrGroupButton );
connect( mInvertSelectionButton, &QAbstractButton::clicked, this, &QgsAttributesFormProperties::onInvertSelectionButtonClicked );
connect( mEditorLayoutComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsAttributesFormProperties::mEditorLayoutComboBox_currentIndexChanged );
connect( pbnSelectEditForm, &QToolButton::clicked, this, &QgsAttributesFormProperties::pbnSelectEditForm_clicked );
connect( mTbInitCode, &QPushButton::clicked, this, &QgsAttributesFormProperties::mTbInitCode_clicked );
@@ -523,6 +524,16 @@ void QgsAttributesFormProperties::onAttributeSelectionChanged()
}
}

void QgsAttributesFormProperties::onInvertSelectionButtonClicked( bool checked )
{
Q_UNUSED( checked );
const auto selectedItemList { mFormLayoutTree->selectedItems() };
const auto rootItem { mFormLayoutTree->invisibleRootItem() };
for ( int i = 0; i < rootItem->childCount(); ++i )
{
rootItem->child( i )->setSelected( ! selectedItemList.contains( rootItem->child( i ) ) );
}
}

void QgsAttributesFormProperties::addTabOrGroupButton()
{
@@ -625,20 +636,23 @@ void QgsAttributesFormProperties::mEditorLayoutComboBox_currentIndexChanged( int
mUiFileFrame->setVisible( false );
mAddTabOrGroupButton->setVisible( false );
mRemoveTabOrGroupButton->setVisible( false );
mInvertSelectionButton->setVisible( false );
break;

case 1:
mFormLayoutWidget->setVisible( true );
mUiFileFrame->setVisible( false );
mAddTabOrGroupButton->setVisible( true );
mRemoveTabOrGroupButton->setVisible( true );
mInvertSelectionButton->setVisible( true );
break;

case 2:
mFormLayoutWidget->setVisible( false );
mUiFileFrame->setVisible( true );
mAddTabOrGroupButton->setVisible( false );
mRemoveTabOrGroupButton->setVisible( false );
mInvertSelectionButton->setVisible( false );
break;
}
}
@@ -185,7 +185,6 @@ class APP_EXPORT QgsAttributesFormProperties : public QWidget, private Ui_QgsAtt
void init();
void apply();

void onAttributeSelectionChanged();

void loadRelations();

@@ -209,7 +208,13 @@ class APP_EXPORT QgsAttributesFormProperties : public QWidget, private Ui_QgsAtt
QgsAttributeTypeDialog *mAttributeTypeDialog = nullptr;
QgsAttributeRelationEdit *mAttributeRelationEdit = nullptr;

private slots:

void onInvertSelectionButtonClicked( bool checked );
void onAttributeSelectionChanged();

private:

void loadAttributeTypeDialog();
void storeAttributeTypeDialog( );

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>653</width>
<width>1041</width>
<height>556</height>
</rect>
</property>
@@ -151,18 +151,7 @@ Use this function to add extra logic to your forms.</string>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QToolButton" name="mAddTabOrGroupButton">
<property name="text">
<string>…</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyAdd.svg</normaloff>:/images/themes/default/symbologyAdd.svg</iconset>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="6">
<item row="0" column="1" rowspan="7">
<widget class="QWidget" name="mFormLayoutWidget" native="true">
<property name="minimumSize">
<size>
@@ -172,18 +161,7 @@ Use this function to add extra logic to your forms.</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="mRemoveTabOrGroupButton">
<property name="text">
<string>…</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyRemove.svg</normaloff>:/images/themes/default/symbologyRemove.svg</iconset>
</property>
</widget>
</item>
<item row="3" column="2">
<item row="4" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -196,7 +174,7 @@ Use this function to add extra logic to your forms.</string>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="6">
<item row="0" column="0" rowspan="7">
<widget class="QWidget" name="mAvailableWidgetsWidget" native="true">
<property name="minimumSize">
<size>
@@ -206,6 +184,42 @@ Use this function to add extra logic to your forms.</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="mRemoveTabOrGroupButton">
<property name="text">
<string>…</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyRemove.svg</normaloff>:/images/themes/default/symbologyRemove.svg</iconset>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="mAddTabOrGroupButton">
<property name="text">
<string>…</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyAdd.svg</normaloff>:/images/themes/default/symbologyAdd.svg</iconset>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QToolButton" name="mInvertSelectionButton">
<property name="toolTip">
<string>Invert selection</string>
</property>
<property name="text">
<string>Invert selection</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionInvertSelection.svg</normaloff>:/images/themes/default/mActionInvertSelection.svg</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QScrollArea" name="scrollArea_2">
@@ -223,8 +237,8 @@ Use this function to add extra logic to your forms.</string>
<rect>
<x>0</x>
<y>0</y>
<width>596</width>
<height>428</height>
<width>598</width>
<height>490</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">

0 comments on commit 1942507

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