Mercurial > octave
changeset 28273:74af52e0e0fa
maint: merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 08 May 2020 00:57:48 -0400 |
parents | 5e1f4060289a (current diff) 86625d488314 (diff) |
children | dd5ab20e547a |
files | |
diffstat | 1 files changed, 19 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/variable-editor-model.cc Thu May 07 13:14:07 2020 -0700 +++ b/libgui/src/variable-editor-model.cc Fri May 08 00:57:48 2020 -0400 @@ -965,11 +965,21 @@ if (is_editable ()) { - beginInsertRows (QModelIndex (), 0, display_rows () - 1); - endInsertRows (); + int new_rows = display_rows (); + + if (new_rows > 0) + { + beginInsertRows (QModelIndex (), 0, new_rows-1); + endInsertRows (); + } - beginInsertColumns (QModelIndex (), 0, display_columns () - 1); - endInsertColumns (); + int new_cols = display_columns (); + + if (new_cols > 0) + { + beginInsertColumns (QModelIndex (), 0, new_cols-1); + endInsertColumns (); + } } } @@ -1264,10 +1274,12 @@ change_display_size (old_rows, old_cols, new_rows, new_cols); // Even if the size doesn't change, we still need to update here - // because the data may have changed. + // because the data may have changed. But only if we have some data + // to display. - emit dataChanged (QAbstractTableModel::index (0, 0), - QAbstractTableModel::index (new_rows-1, new_cols-1)); + if (new_rows > 0 && new_cols > 0) + emit dataChanged (QAbstractTableModel::index (0, 0), + QAbstractTableModel::index (new_rows-1, new_cols-1)); clear_update_pending (); }