Rename private viewOptions to viewOptionsV1

Renaming of the private implementation of viewOptions to viewOptionsV1
so that future updates of QStyleOptionViewItem can be easily integrated
in the code with a simple search/replace.

Task-number: QTBUG-1180
Change-Id: I18f876a435417717fa0d759bb302a7c6059daf80
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Samuel Gaist 2013-10-10 16:43:44 +02:00 committed by The Qt Project
parent cc3ece1da4
commit 72544a5142
6 changed files with 22 additions and 22 deletions

View File

@ -1651,7 +1651,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
case QEvent::WhatsThis: {
QHelpEvent *he = static_cast<QHelpEvent*>(event);
const QModelIndex index = indexAt(he->pos());
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
option.rect = visualRect(index);
option.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
@ -1851,7 +1851,7 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
emit clicked(index);
if (edited)
return;
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
if (d->pressedAlreadySelected)
option.state |= QStyle::State_Selected;
if ((model()->flags(index) & Qt::ItemIsEnabled)
@ -2627,7 +2627,7 @@ void QAbstractItemView::updateEditorGeometries()
Q_D(QAbstractItemView);
if(d->editorIndexHash.isEmpty())
return;
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
QEditorIndexHash::iterator it = d->editorIndexHash.begin();
QWidgetList editorsToRelease;
QWidgetList editorsToHide;
@ -2972,7 +2972,7 @@ QSize QAbstractItemView::sizeHintForIndex(const QModelIndex &index) const
Q_D(const QAbstractItemView);
if (!d->isIndexValid(index) || !d->itemDelegate)
return QSize();
return d->delegateForIndex(index)->sizeHint(d->viewOptions(), index);
return d->delegateForIndex(index)->sizeHint(d->viewOptionsV1(), index);
}
/*!
@ -3000,7 +3000,7 @@ int QAbstractItemView::sizeHintForRow(int row) const
ensurePolished();
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
int height = 0;
int colCount = d->model->columnCount(d->root);
QModelIndex index;
@ -3031,7 +3031,7 @@ int QAbstractItemView::sizeHintForColumn(int column) const
ensurePolished();
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
int width = 0;
int rows = d->model->rowCount(d->root);
QModelIndex index;
@ -3054,7 +3054,7 @@ int QAbstractItemView::sizeHintForColumn(int column) const
void QAbstractItemView::openPersistentEditor(const QModelIndex &index)
{
Q_D(QAbstractItemView);
QStyleOptionViewItem options = d->viewOptions();
QStyleOptionViewItem options = d->viewOptionsV1();
options.rect = visualRect(index);
options.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
@ -3633,7 +3633,7 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const
return option;
}
QStyleOptionViewItem QAbstractItemViewPrivate::viewOptions() const
QStyleOptionViewItem QAbstractItemViewPrivate::viewOptionsV1() const
{
Q_Q(const QAbstractItemView);
return q->viewOptions();
@ -4274,7 +4274,7 @@ bool QAbstractItemViewPrivate::sendDelegateEvent(const QModelIndex &index, QEven
{
Q_Q(const QAbstractItemView);
QModelIndex buddy = model->buddy(index);
QStyleOptionViewItem options = viewOptions();
QStyleOptionViewItem options = viewOptionsV1();
options.rect = q->visualRect(buddy);
options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
QAbstractItemDelegate *delegate = delegateForIndex(index);
@ -4286,7 +4286,7 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even
Q_Q(QAbstractItemView);
QModelIndex buddy = model->buddy(index);
QStyleOptionViewItem options = viewOptions();
QStyleOptionViewItem options = viewOptionsV1();
options.rect = q->visualRect(buddy);
options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
@ -4338,7 +4338,7 @@ QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes,
QPixmap pixmap(r->size());
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
QStyleOptionViewItem option = viewOptions();
QStyleOptionViewItem option = viewOptionsV1();
option.state |= QStyle::State_Selected;
for (int j = 0; j < paintPairs.count(); ++j) {
option.rect = paintPairs.at(j).first.translated(-r->topLeft());

View File

@ -347,7 +347,7 @@ public:
QModelIndexList selectedDraggableIndexes() const;
QStyleOptionViewItem viewOptions() const;
QStyleOptionViewItem viewOptionsV1() const;
void doDelayedReset()
{

View File

@ -927,7 +927,7 @@ void QListView::paintEvent(QPaintEvent *e)
Q_D(QListView);
if (!d->itemDelegate)
return;
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
QPainter painter(d->viewport);
const QVector<QModelIndex> toBeRendered = d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false);
@ -1456,7 +1456,7 @@ void QListView::updateGeometries()
verticalScrollBar()->setRange(0, 0);
} else {
QModelIndex index = d->model->index(0, d->column, d->root);
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
QSize step = d->itemSize(option, index);
d->commonListView->updateHorizontalScrollBar(step);
d->commonListView->updateVerticalScrollBar(step);

View File

@ -465,7 +465,7 @@ inline QModelIndex QCommonListViewBase::modelIndex(int row) const
{ return dd->model->index(row, dd->column, dd->root); }
inline int QCommonListViewBase::rowCount() const { return dd->model->rowCount(dd->root); }
inline QStyleOptionViewItem QCommonListViewBase::viewOptions() const { return dd->viewOptions(); }
inline QStyleOptionViewItem QCommonListViewBase::viewOptions() const { return dd->viewOptionsV1(); }
inline QWidget *QCommonListViewBase::viewport() const { return dd->viewport; }
inline QRect QCommonListViewBase::clipRect() const { return dd->clipRect(); }

View File

@ -1363,7 +1363,7 @@ void QTableView::paintEvent(QPaintEvent *event)
{
Q_D(QTableView);
// setup temp variables for the painting
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
const QPoint offset = d->scrollDelayOffset;
const bool showGrid = d->showGrid;
const int gridSize = showGrid ? 1 : 0;
@ -2235,7 +2235,7 @@ int QTableView::sizeHintForRow(int row) const
if (right == -1) // the table don't have enough columns to fill the viewport
right = d->model->columnCount(d->root) - 1;
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
int hint = 0;
QModelIndex index;
@ -2323,7 +2323,7 @@ int QTableView::sizeHintForColumn(int column) const
if (!isVisible() || bottom == -1) // the table don't have enough rows to fill the viewport
bottom = d->model->rowCount(d->root) - 1;
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
int hint = 0;
int rowsProcessed = 0;

View File

@ -1441,7 +1441,7 @@ void QTreeView::drawTree(QPainter *painter, const QRegion &region) const
Q_D(const QTreeView);
const QVector<QTreeViewItem> viewItems = d->viewItems;
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
const QStyle::State state = option.state;
d->current = 0;
@ -2850,7 +2850,7 @@ int QTreeView::sizeHintForColumn(int column) const
return -1;
ensurePolished();
int w = 0;
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
const QVector<QTreeViewItem> viewItems = d->viewItems;
const int maximumProcessRows = d->header->resizeContentsPrecision(); // To avoid this to take forever.
@ -2947,7 +2947,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const
qSwap(end, start);
int height = -1;
QStyleOptionViewItem option = d->viewOptions();
QStyleOptionViewItem option = d->viewOptionsV1();
// ### If we want word wrapping in the items,
// ### we need to go through all the columns
// ### and set the width of the column
@ -3220,7 +3220,7 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons
painter.end();
//and now let's render the editors the editors
QStyleOptionViewItem option = viewOptions();
QStyleOptionViewItem option = viewOptionsV1();
for (QEditorIndexHash::const_iterator it = editorIndexHash.constBegin(); it != editorIndexHash.constEnd(); ++it) {
QWidget *editor = it.key();
const QModelIndex &index = it.value();