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.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index b1557e9af4..67c01adea7 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -77,13 +77,13 @@ QT_BEGIN_NAMESPACE
QAbstractItemViewPrivate::QAbstractItemViewPrivate()
: model(QAbstractItemModelPrivate::staticEmptyModel()),
- itemDelegate(0),
- selectionModel(0),
+ itemDelegate(nullptr),
+ selectionModel(nullptr),
ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate),
noSelectionOnMousePress(false),
selectionMode(QAbstractItemView::ExtendedSelection),
selectionBehavior(QAbstractItemView::SelectItems),
- currentlyCommittingEditor(0),
+ currentlyCommittingEditor(nullptr),
pressedModifiers(Qt::NoModifier),
pressedPosition(QPoint(-1, -1)),
pressedAlreadySelected(false),
@@ -145,8 +145,8 @@ void QAbstractItemViewPrivate::init()
q->setAttribute(Qt::WA_InputMethodEnabled);
- verticalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, q, 0));
- horizontalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, q, 0));
+ verticalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, q, nullptr));
+ horizontalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, q, nullptr));
}
void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index)
@@ -757,7 +757,7 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
QAbstractItemModel *QAbstractItemView::model() const
{
Q_D(const QAbstractItemView);
- return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model);
+ return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? nullptr : d->model);
}
/*!
@@ -915,7 +915,7 @@ QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const
void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *delegate)
{
Q_D(QAbstractItemView);
- if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, 0)) {
+ if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, nullptr)) {
if (d->delegateRefCount(rowDelegate) == 1) {
disconnect(rowDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
@@ -949,7 +949,7 @@ void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *de
QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const
{
Q_D(const QAbstractItemView);
- return d->rowDelegates.value(row, 0);
+ return d->rowDelegates.value(row, nullptr);
}
/*!
@@ -975,7 +975,7 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const
void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate)
{
Q_D(QAbstractItemView);
- if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, 0)) {
+ if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, nullptr)) {
if (d->delegateRefCount(columnDelegate) == 1) {
disconnect(columnDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
@@ -1009,7 +1009,7 @@ void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelega
QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) const
{
Q_D(const QAbstractItemView);
- return d->columnDelegates.value(column, 0);
+ return d->columnDelegates.value(column, nullptr);
}
/*!
@@ -1084,7 +1084,7 @@ void QAbstractItemView::setCurrentIndex(const QModelIndex &index)
{
Q_D(QAbstractItemView);
if (d->selectionModel && (!index.isValid() || d->isIndexEnabled(index))) {
- QItemSelectionModel::SelectionFlags command = selectionCommand(index, 0);
+ QItemSelectionModel::SelectionFlags command = selectionCommand(index, nullptr);
d->selectionModel->setCurrentIndex(index, command);
d->currentIndexSet = true;
if ((command & QItemSelectionModel::Current) == 0)
@@ -1201,7 +1201,7 @@ void QAbstractItemView::edit(const QModelIndex &index)
Q_D(QAbstractItemView);
if (Q_UNLIKELY(!d->isIndexValid(index)))
qWarning("edit: index was invalid");
- if (Q_UNLIKELY(!edit(index, AllEditTriggers, 0)))
+ if (Q_UNLIKELY(!edit(index, AllEditTriggers, nullptr)))
qWarning("edit: editing failed");
}
@@ -1286,7 +1286,7 @@ QAbstractItemView::ScrollMode QAbstractItemView::verticalScrollMode() const
void QAbstractItemView::resetVerticalScrollMode()
{
- auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, this, 0));
+ auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, this, nullptr));
setVerticalScrollMode(sm);
d_func()->verticalScrollModeSet = false;
}
@@ -1323,7 +1323,7 @@ QAbstractItemView::ScrollMode QAbstractItemView::horizontalScrollMode() const
void QAbstractItemView::resetHorizontalScrollMode()
{
- auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, this, 0));
+ auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, nullptr, this, nullptr));
setHorizontalScrollMode(sm);
d_func()->horizontalScrollModeSet = false;
}
@@ -1964,7 +1964,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
QPersistentModelIndex persistent = index;
emit doubleClicked(persistent);
if ((event->button() == Qt::LeftButton) && !edit(persistent, DoubleClicked, event)
- && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this))
+ && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this))
emit activated(persistent);
d->pressedIndex = QModelIndex();
}
@@ -2388,7 +2388,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
setFocus();
QItemSelectionModel::SelectionFlags command = selectionCommand(newCurrent, event);
if (command != QItemSelectionModel::NoUpdate
- || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, 0, this)) {
+ || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, nullptr, this)) {
// note that we don't check if the new current index is enabled because moveCursor() makes sure it is
if (command & QItemSelectionModel::Current) {
d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate);
@@ -2654,7 +2654,7 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve
if (!d->isIndexValid(index))
return false;
- if (QWidget *w = (d->persistent.isEmpty() ? static_cast<QWidget*>(0) : d->editorForIndex(index).widget.data())) {
+ if (QWidget *w = (d->persistent.isEmpty() ? static_cast<QWidget*>(nullptr) : d->editorForIndex(index).widget.data())) {
if (w->focusPolicy() == Qt::NoFocus)
return false;
w->setFocus();
@@ -2692,7 +2692,7 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve
if (trigger == SelectedClicked)
d->delayedEditing.start(QApplication::doubleClickInterval(), this);
else
- d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0);
+ d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : nullptr);
return true;
}
@@ -2909,7 +2909,7 @@ void QAbstractItemView::commitData(QWidget *editor)
editor->removeEventFilter(delegate);
delegate->setModelData(editor, d->model, index);
editor->installEventFilter(delegate);
- d->currentlyCommittingEditor = 0;
+ d->currentlyCommittingEditor = nullptr;
}
/*!
@@ -3260,7 +3260,7 @@ QWidget* QAbstractItemView::indexWidget(const QModelIndex &index) const
if (QWidget *editor = d->editorForIndex(index).widget.data())
return editor;
- return 0;
+ return nullptr;
}
/*!
@@ -3673,7 +3673,7 @@ void QAbstractItemView::currentChanged(const QModelIndex &current, const QModelI
if (d->autoScroll)
scrollTo(current);
update(current);
- edit(current, CurrentChanged, 0);
+ edit(current, CurrentChanged, nullptr);
if (current.row() == (d->model->rowCount(d->root) - 1))
d->fetchMore();
} else {
@@ -3737,7 +3737,7 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const
if (d->iconSize.isValid()) {
option.decorationSize = d->iconSize;
} else {
- int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
+ int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
option.decorationSize = QSize(pm, pm);
}
option.decorationPosition = QStyleOptionViewItem::Left;
@@ -3745,7 +3745,7 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const
option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter;
option.textElideMode = d->textElideMode;
option.rect = QRect();
- option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, this);
+ option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, nullptr, this);
if (d->wrapItemText)
option.features = QStyleOptionViewItem::WrapText;
option.locale = locale();
@@ -4231,7 +4231,7 @@ QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index,
if (!w) {
QAbstractItemDelegate *delegate = delegateForIndex(index);
if (!delegate)
- return 0;
+ return nullptr;
w = delegate->createEditor(viewport, options, index);
if (w) {
w->installEventFilter(delegate);