Core: Handle editor event only for real items

Rows which do not fill an entire row are treated
as if they contained empty placeholder items.
Do not try to handle these as the item data for
these will be a nullptr.

Change-Id: Ia9420aeafe3e2a0a3f7d29208ad21c81e52ac81a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Stenger
2020-01-22 06:58:21 +01:00
parent 4070d6a289
commit 5353532fa2

View File

@@ -592,7 +592,8 @@ bool ListItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
{
if (event->type() == QEvent::MouseButtonRelease) {
const ListItem *item = index.data(ListModel::ItemRole).value<ListItem *>();
QTC_ASSERT(item, return false);
if (!item)
return false;
auto mev = static_cast<QMouseEvent *>(event);
if (index.isValid()) {
const QPoint pos = mev->pos();