mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
when adding new container in form designer, preselect the current group as parent (#35332)
This commit is contained in:
parent
b1d50c2116
commit
e697b7f062
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user