Skip to content
Permalink
Browse files

when adding new container in form designer, preselect the current gro…

…up as parent (#35332)
  • Loading branch information
3nids committed Mar 25, 2020
1 parent b1d50c2 commit e697b7f062a261abc14934210835afdec7af07c6
Showing with 9 additions and 3 deletions.
  1. +6 −1 src/gui/qgsaddtaborgroup.cpp
  2. +1 −1 src/gui/qgsaddtaborgroup.h
  3. +2 −1 src/gui/vector/qgsattributesformproperties.cpp
@@ -25,7 +25,7 @@
#include <QComboBox>
#include <QRadioButton>

QgsAddTabOrGroup::QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList < TabPair > &tabList, QWidget *parent )
QgsAddTabOrGroup::QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList < TabPair > &tabList, QTreeWidgetItem *currentTab, QWidget *parent )
: QDialog( parent )
, mLayer( lyr )
, mTabs( tabList )
@@ -43,6 +43,11 @@ QgsAddTabOrGroup::QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList < TabPair >
for ( const TabPair &tab : constMTabs )
{
mTabList->addItem( tab.first, i );
if ( tab.second == currentTab )
{
mTabList->setCurrentIndex( i );
mGroupButton->setChecked( true );
}
++i;
}
}
@@ -46,7 +46,7 @@ class GUI_EXPORT QgsAddTabOrGroup : public QDialog, private Ui::QgsAddTabOrGroup

public:
//! constructor
QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList<TabPair> &tabList, QWidget *parent = nullptr );
QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList<TabPair> &tabList, QTreeWidgetItem *currentTab = nullptr, QWidget *parent = nullptr );

//! Returns the name of the tab or group
QString name();
@@ -658,7 +658,8 @@ void QgsAttributesFormProperties::addTabOrGroupButton()
tabList.append( QgsAddTabOrGroup::TabPair( itemData.name(), *it ) );
}
}
QgsAddTabOrGroup addTabOrGroup( mLayer, tabList, this );
QTreeWidgetItem *currentItem = mFormLayoutTree->selectedItems().at( 0 );
QgsAddTabOrGroup addTabOrGroup( mLayer, tabList, currentItem, this );

if ( !addTabOrGroup.exec() )
return;

0 comments on commit e697b7f

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