Skip to content

Commit 52240ad

Browse files
committed
fixed problem with saving first entry
1 parent 2c0d518 commit 52240ad

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/app/qgsattributesformproperties.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ QgsAttributesFormProperties::QgsAttributesFormProperties( QgsVectorLayer *layer,
4646
mFormLayoutTree->setType( DnDTree::Type::Drop );
4747

4848
// AttributeTypeDialog
49-
mAttributeTypeDialog = new QgsAttributeTypeDialog( mLayer, 0, mAttributeTypeFrame );
49+
mAttributeTypeDialog = new QgsAttributeTypeDialog( mLayer, -1, mAttributeTypeFrame );
5050
mAttributeTypeDialog->layout()->setMargin( 0 );
5151
mAttributeTypeFrame->layout()->setMargin( 0 );
5252
mAttributeTypeFrame->layout()->addWidget( mAttributeTypeDialog );
@@ -79,8 +79,8 @@ void QgsAttributesFormProperties::init()
7979
initLayoutConfig();
8080
initInitPython();
8181

82-
//mAttributeTypeDialog->setEnabled( false );
83-
//mAttributeRelationEdit->setEnabled( false );
82+
mAttributeTypeDialog->setEnabled( false );
83+
mAttributeRelationEdit->setEnabled( false );
8484
}
8585

8686
void QgsAttributesFormProperties::initAvailableWidgetsTree()
@@ -264,6 +264,9 @@ void QgsAttributesFormProperties::loadAttributeTypeDialog()
264264

265265
void QgsAttributesFormProperties::storeAttributeTypeDialog()
266266
{
267+
if ( mAttributeTypeDialog->fieldIdx() < 0 )
268+
return;
269+
267270
FieldConfig cfg;
268271

269272
cfg.mEditable = mAttributeTypeDialog->fieldEditable();

src/app/qgsattributetypedialog.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ QgsAttributeTypeDialog::QgsAttributeTypeDialog( QgsVectorLayer *vl, int fieldIdx
4545
, mFieldIdx( fieldIdx )
4646
{
4747
setupUi( this );
48-
//removed selectionListWidget: connect( selectionListWidget, &QListWidget::currentRowChanged, this, &QgsAttributeTypeDialog::selectionListWidget_currentRowChanged );
49-
setWindowTitle( tr( "Edit Widget Properties - %1 (%2)" ).arg( vl->fields().at( fieldIdx ).name(), vl->name() ) );
48+
49+
if ( fieldIdx < 0 )
50+
return;
5051

5152
QMapIterator<QString, QgsEditorWidgetFactory *> it( QgsGui::editorWidgetRegistry()->factories() );
5253
QStandardItemModel *widgetTypeModel = qobject_cast<QStandardItemModel *>( mWidgetTypeComboBox->model() );
@@ -89,11 +90,6 @@ QgsAttributeTypeDialog::QgsAttributeTypeDialog( QgsVectorLayer *vl, int fieldIdx
8990
restoreGeometry( settings.value( QStringLiteral( "Windows/QgsAttributeTypeDialog/geometry" ) ).toByteArray() );
9091

9192
constraintExpressionWidget->setLayer( vl );
92-
93-
// TODO, what should this help be connected to?
94-
#if 0
95-
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsAttributeTypeDialog::showHelp );
96-
#endif
9793
}
9894

9995
QgsAttributeTypeDialog::~QgsAttributeTypeDialog()

0 commit comments

Comments
 (0)