summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/itemviews/qabstractitemview.cpp')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 2caf5d1eb3..3bb4d0624f 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1882,8 +1882,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
|| (d->pressedIndex != index)) {
QMouseEvent me(QEvent::MouseButtonPress,
event->localPos(), event->windowPos(), event->screenPos(),
- event->button(), event->buttons(), event->modifiers());
- QGuiApplicationPrivate::setMouseEventSource(&me, event->source());
+ event->button(), event->buttons(), event->modifiers(), event->source());
mousePressEvent(&me);
return;
}
@@ -2386,7 +2385,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
}
#endif
break;
-#ifdef Q_OS_MAC
+#ifdef Q_OS_OSX
case Qt::Key_Enter:
case Qt::Key_Return:
// Propagate the enter if you couldn't edit the item and there are no
@@ -2416,7 +2415,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
selectAll();
break;
}
-#ifdef Q_OS_MAC
+#ifdef Q_OS_OSX
if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) {
emit activated(currentIndex());
break;
@@ -3017,13 +3016,12 @@ int QAbstractItemView::sizeHintForRow(int row) const
QStyleOptionViewItem option = d->viewOptionsV1();
int height = 0;
int colCount = d->model->columnCount(d->root);
- QModelIndex index;
for (int c = 0; c < colCount; ++c) {
- index = d->model->index(row, c, d->root);
+ 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;
}
@@ -3048,13 +3046,12 @@ int QAbstractItemView::sizeHintForColumn(int column) const
QStyleOptionViewItem option = d->viewOptionsV1();
int width = 0;
int rows = d->model->rowCount(d->root);
- QModelIndex index;
for (int r = 0; r < rows; ++r) {
- index = d->model->index(r, column, d->root);
+ 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;
}