diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-02 14:39:23 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-19 11:06:22 +0000 |
commit | 2042a091a3e88a77d52b6cdb62f3fc9153d7f5d7 (patch) | |
tree | ef581080776ba020137c20738f7e6e4ebadf6e83 /src/widgets/itemviews | |
parent | e56938b4bb244dfccdb78aed66c842d65fe64c14 (diff) | |
download | qtbase-2042a091a3e88a77d52b6cdb62f3fc9153d7f5d7.tar.gz |
QAbstractItemView::sizeHintForRow()/Column: Check for null delegate.
The delegate may be null in QHeaderView.
Task-number: QTBUG-48543
Change-Id: I4d3ba104b0b57431e8765271dc2dc880be096672
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index c5601b63b2..3bb4d0624f 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -3020,8 +3020,8 @@ int QAbstractItemView::sizeHintForRow(int row) const const QModelIndex index = d->model->index(row, c, d->root); if (QWidget *editor = d->editorForIndex(index).widget.data()) height = qMax(height, editor->height()); - int hint = d->delegateForIndex(index)->sizeHint(option, index).height(); - height = qMax(height, hint); + if (const QAbstractItemDelegate *delegate = d->delegateForIndex(index)) + height = qMax(height, delegate->sizeHint(option, index).height()); } return height; } @@ -3050,8 +3050,8 @@ int QAbstractItemView::sizeHintForColumn(int column) const const QModelIndex index = d->model->index(r, column, d->root); if (QWidget *editor = d->editorForIndex(index).widget.data()) width = qMax(width, editor->sizeHint().width()); - int hint = d->delegateForIndex(index)->sizeHint(option, index).width(); - width = qMax(width, hint); + if (const QAbstractItemDelegate *delegate = d->delegateForIndex(index)) + width = qMax(width, delegate->sizeHint(option, index).width()); } return width; } |