File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,7 @@ void QgsValueRelationWidgetWrapper::setValue( const QVariant &value )
193
193
if ( item )
194
194
{
195
195
item->setCheckState ( checkList.contains ( item->data ( Qt::UserRole ).toString () ) ? Qt::Checked : Qt::Unchecked );
196
+ // re-set enabled state because it's lost after reloading items
196
197
item->setFlags ( mEnabled ? item->flags () | Qt::ItemIsEnabled : item->flags () & ~Qt::ItemIsEnabled );
197
198
lastChangedItem = item;
198
199
}
@@ -218,7 +219,6 @@ void QgsValueRelationWidgetWrapper::setValue( const QVariant &value )
218
219
}
219
220
}
220
221
mComboBox ->setCurrentIndex ( idx );
221
- mComboBox ->setEnabled ( mEnabled );
222
222
}
223
223
else if ( mLineEdit )
224
224
{
@@ -230,7 +230,6 @@ void QgsValueRelationWidgetWrapper::setValue( const QVariant &value )
230
230
break ;
231
231
}
232
232
}
233
- mLineEdit ->setEnabled ( mEnabled );
234
233
}
235
234
}
236
235
@@ -389,4 +388,24 @@ void QgsValueRelationWidgetWrapper::setEnabled( bool enabled )
389
388
return ;
390
389
391
390
mEnabled = enabled;
391
+
392
+ if ( mTableWidget )
393
+ {
394
+ auto signalBlockedTableWidget = whileBlocking ( mTableWidget );
395
+ Q_UNUSED ( signalBlockedTableWidget )
396
+
397
+ for ( int j = 0 ; j < mTableWidget ->rowCount (); j++ )
398
+ {
399
+ for ( int i = 0 ; i < mTableWidget ->columnCount (); ++i )
400
+ {
401
+ QTableWidgetItem *item = mTableWidget ->item ( j, i );
402
+ if ( item )
403
+ {
404
+ item->setFlags ( enabled ? item->flags () | Qt::ItemIsEnabled : item->flags () & ~Qt::ItemIsEnabled );
405
+ }
406
+ }
407
+ }
408
+ }
409
+ else
410
+ QgsEditorWidgetWrapper::setEnabled ( enabled );
392
411
}
You can’t perform that action at this time.
0 commit comments