@@ -177,6 +177,7 @@ QTreeWidgetItem *QgsFieldsProperties::loadAttributeEditorTreeItem( QgsAttributeE
177
177
break ;
178
178
179
179
itemData.setColumnCount ( container->columnCount () );
180
+ itemData.setShowAsGroupBox ( container->isGroupBox () );
180
181
newWidget = mDesignerTree ->addItem ( parent, itemData );
181
182
182
183
Q_FOREACH ( QgsAttributeEditorElement* wdg, container->children () )
@@ -862,7 +863,7 @@ void QgsFieldsProperties::updateFieldRenamingStatus()
862
863
}
863
864
}
864
865
865
- QgsAttributeEditorElement* QgsFieldsProperties::createAttributeEditorWidget ( QTreeWidgetItem* item, QObject *parent )
866
+ QgsAttributeEditorElement* QgsFieldsProperties::createAttributeEditorWidget ( QTreeWidgetItem* item, QObject *parent , bool forceGroup )
866
867
{
867
868
QgsAttributeEditorElement *widgetDef = nullptr ;
868
869
@@ -887,6 +888,7 @@ QgsAttributeEditorElement* QgsFieldsProperties::createAttributeEditorWidget( QTr
887
888
{
888
889
QgsAttributeEditorContainer* container = new QgsAttributeEditorContainer ( item->text ( 0 ), parent );
889
890
container->setColumnCount ( itemData.columnCount () );
891
+ container->setIsGroupBox ( forceGroup ? true : itemData.showAsGroupBox () );
890
892
891
893
for ( int t = 0 ; t < item->childCount (); t++ )
892
894
{
@@ -985,7 +987,7 @@ void QgsFieldsProperties::apply()
985
987
{
986
988
QTreeWidgetItem* tabItem = mDesignerTree ->invisibleRootItem ()->child ( t );
987
989
988
- mLayer ->editFormConfig ()->addTab ( createAttributeEditorWidget ( tabItem, mLayer ) );
990
+ mLayer ->editFormConfig ()->addTab ( createAttributeEditorWidget ( tabItem, mLayer , false ) );
989
991
}
990
992
991
993
mLayer ->editFormConfig ()->setLayout (( QgsEditFormConfig::EditorLayout ) mEditorLayoutComboBox ->currentIndex () );
@@ -1273,6 +1275,7 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem* item, int column )
1273
1275
QFormLayout* layout = new QFormLayout () ;
1274
1276
dlg.setLayout ( layout );
1275
1277
1278
+ QCheckBox* showAsGroupBox = nullptr ;
1276
1279
QLineEdit* title = new QLineEdit ( itemData.name () );
1277
1280
QSpinBox* columnCount = new QSpinBox ();
1278
1281
columnCount->setRange ( 1 , 5 );
@@ -1281,6 +1284,13 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem* item, int column )
1281
1284
layout->addRow ( tr ( " Title" ), title );
1282
1285
layout->addRow ( tr ( " Column count" ), columnCount );
1283
1286
1287
+ if ( !item->parent () )
1288
+ {
1289
+ showAsGroupBox = new QCheckBox ( tr ( " Show as group box" ) );
1290
+ showAsGroupBox->setChecked ( itemData.showAsGroupBox () );
1291
+ layout->addRow ( tr ( " Show as group box" ), showAsGroupBox );
1292
+ }
1293
+
1284
1294
QDialogButtonBox* buttonBox = new QDialogButtonBox ( QDialogButtonBox::Ok
1285
1295
| QDialogButtonBox::Cancel );
1286
1296
@@ -1292,6 +1302,7 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem* item, int column )
1292
1302
if ( dlg.exec () )
1293
1303
{
1294
1304
itemData.setColumnCount ( columnCount->value () );
1305
+ itemData.setShowAsGroupBox ( showAsGroupBox ? showAsGroupBox->isChecked () : true );
1295
1306
itemData.setName ( title->text () );
1296
1307
item->setData ( 0 , QgsFieldsProperties::DesignerTreeRole, itemData.asQVariant () );
1297
1308
item->setText ( 0 , title->text () );
@@ -1321,3 +1332,13 @@ QDataStream& operator>>( QDataStream& stream, QgsFieldsProperties::DesignerTreeI
1321
1332
1322
1333
return stream;
1323
1334
}
1335
+
1336
+ bool QgsFieldsProperties::DesignerTreeItemData::showAsGroupBox () const
1337
+ {
1338
+ return mShowAsGroupBox ;
1339
+ }
1340
+
1341
+ void QgsFieldsProperties::DesignerTreeItemData::setShowAsGroupBox ( bool showAsGroupBox )
1342
+ {
1343
+ mShowAsGroupBox = showAsGroupBox;
1344
+ }
0 commit comments