Skip to content

Commit f8d8108

Browse files
committed
#14274 Fix invalid index range in dataChanged() from table row editor
Valid Qt column indices are 0..columnCount()-1, but the bottom-right model index was constructed with column columnCount(). Since QAbstractItemModel::index() validates its arguments, this produced an invalid QModelIndex(-1,-1) passed to dataChanged(), causing a console warning on every table row update, e.g. when adding or moving 3D well path pick targets. Fix the same off-by-one in modelIndexFromPdmObject(). Fixes #14274.
1 parent 6357cef commit f8d8108

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Fwk/AppFwk/cafUserInterface/cafPdmUiTableRowEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void PdmUiTableRowEditor::configureAndUpdateUi( const QString& uiConfigName )
7979
if ( m_model )
8080
{
8181
QModelIndex miStart = m_model->index( m_row, 0 );
82-
QModelIndex miEnd = m_model->index( m_row, m_model->columnCount() );
82+
QModelIndex miEnd = m_model->index( m_row, m_model->columnCount() - 1 );
8383

8484
m_model->notifyDataChanged( miStart, miEnd );
8585
}

Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ QItemSelection PdmUiTableViewQModel::modelIndexFromPdmObject( PdmObjectHandle* p
739739
if ( obj == pdmObject )
740740
{
741741
// Select whole row
742-
itemSelection.select( this->createIndex( i, 0 ), this->createIndex( i, this->columnCount() ) );
742+
itemSelection.select( this->createIndex( i, 0 ), this->createIndex( i, this->columnCount() - 1 ) );
743743
}
744744
}
745745

0 commit comments

Comments
 (0)