Clean up itemviews after QStyleOption version cleanup
Change-Id: I56cb1cfd9977dedd89947dfe2bf9edb70297e31f Task-number: QTBUG-84221 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>bb10
parent
4292ad0292
commit
71b4b6b555
|
|
@ -1718,7 +1718,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
|
|||
case QEvent::WhatsThis: {
|
||||
QHelpEvent *he = static_cast<QHelpEvent*>(event);
|
||||
const QModelIndex index = indexAt(he->pos());
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
option.rect = visualRect(index);
|
||||
option.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
|
||||
|
||||
|
|
@ -1931,7 +1931,7 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
|
|||
emit clicked(index);
|
||||
if (edited)
|
||||
return;
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
if (d->pressedAlreadySelected)
|
||||
option.state |= QStyle::State_Selected;
|
||||
if ((d->model->flags(index) & Qt::ItemIsEnabled)
|
||||
|
|
@ -2720,7 +2720,7 @@ void QAbstractItemView::updateEditorGeometries()
|
|||
d->executePostedLayout();
|
||||
return;
|
||||
}
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
QEditorIndexHash::iterator it = d->editorIndexHash.begin();
|
||||
QWidgetList editorsToRelease;
|
||||
QWidgetList editorsToHide;
|
||||
|
|
@ -3018,7 +3018,7 @@ QSize QAbstractItemView::sizeHintForIndex(const QModelIndex &index) const
|
|||
if (!d->isIndexValid(index))
|
||||
return QSize();
|
||||
const auto delegate = d->delegateForIndex(index);
|
||||
return delegate ? delegate->sizeHint(d->viewOptionsV1(), index) : QSize();
|
||||
return delegate ? delegate->sizeHint(viewOptions(), index) : QSize();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -3046,7 +3046,7 @@ int QAbstractItemView::sizeHintForRow(int row) const
|
|||
|
||||
ensurePolished();
|
||||
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
int height = 0;
|
||||
int colCount = d->model->columnCount(d->root);
|
||||
for (int c = 0; c < colCount; ++c) {
|
||||
|
|
@ -3076,7 +3076,7 @@ int QAbstractItemView::sizeHintForColumn(int column) const
|
|||
|
||||
ensurePolished();
|
||||
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
int width = 0;
|
||||
int rows = d->model->rowCount(d->root);
|
||||
for (int r = 0; r < rows; ++r) {
|
||||
|
|
@ -3098,7 +3098,7 @@ int QAbstractItemView::sizeHintForColumn(int column) const
|
|||
void QAbstractItemView::openPersistentEditor(const QModelIndex &index)
|
||||
{
|
||||
Q_D(QAbstractItemView);
|
||||
QStyleOptionViewItem options = d->viewOptionsV1();
|
||||
QStyleOptionViewItem options = viewOptions();
|
||||
options.rect = visualRect(index);
|
||||
options.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
|
||||
|
||||
|
|
@ -3725,12 +3725,6 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const
|
|||
return option;
|
||||
}
|
||||
|
||||
QStyleOptionViewItem QAbstractItemViewPrivate::viewOptionsV1() const
|
||||
{
|
||||
Q_Q(const QAbstractItemView);
|
||||
return q->viewOptions();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the item view's state.
|
||||
|
||||
|
|
@ -4358,7 +4352,7 @@ bool QAbstractItemViewPrivate::sendDelegateEvent(const QModelIndex &index, QEven
|
|||
{
|
||||
Q_Q(const QAbstractItemView);
|
||||
QModelIndex buddy = model->buddy(index);
|
||||
QStyleOptionViewItem options = viewOptionsV1();
|
||||
QStyleOptionViewItem options = q->viewOptions();
|
||||
options.rect = q->visualRect(buddy);
|
||||
options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
|
||||
QAbstractItemDelegate *delegate = delegateForIndex(index);
|
||||
|
|
@ -4370,7 +4364,7 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even
|
|||
Q_Q(QAbstractItemView);
|
||||
|
||||
QModelIndex buddy = model->buddy(index);
|
||||
QStyleOptionViewItem options = viewOptionsV1();
|
||||
QStyleOptionViewItem options = q->viewOptions();
|
||||
options.rect = q->visualRect(buddy);
|
||||
options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
|
||||
|
||||
|
|
@ -4416,6 +4410,7 @@ QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIn
|
|||
|
||||
QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const
|
||||
{
|
||||
Q_Q(const QAbstractItemView);
|
||||
Q_ASSERT(r);
|
||||
QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r);
|
||||
if (paintPairs.isEmpty())
|
||||
|
|
@ -4429,7 +4424,7 @@ QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes,
|
|||
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
QStyleOptionViewItem option = viewOptionsV1();
|
||||
QStyleOptionViewItem option = q->viewOptions();
|
||||
option.state |= QStyle::State_Selected;
|
||||
for (int j = 0; j < paintPairs.count(); ++j) {
|
||||
option.rect = paintPairs.at(j).rect.translated(-r->topLeft());
|
||||
|
|
|
|||
|
|
@ -353,8 +353,6 @@ public:
|
|||
|
||||
QModelIndexList selectedDraggableIndexes() const;
|
||||
|
||||
QStyleOptionViewItem viewOptionsV1() const;
|
||||
|
||||
void doDelayedReset()
|
||||
{
|
||||
//we delay the reset of the timer because some views (QTableView)
|
||||
|
|
|
|||
|
|
@ -1005,7 +1005,7 @@ void QListView::paintEvent(QPaintEvent *e)
|
|||
Q_D(QListView);
|
||||
if (!d->itemDelegate)
|
||||
return;
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
QPainter painter(d->viewport);
|
||||
|
||||
const QList<QModelIndex> toBeRendered =
|
||||
|
|
@ -1555,7 +1555,7 @@ void QListView::updateGeometries()
|
|||
verticalScrollBar()->setRange(0, 0);
|
||||
} else {
|
||||
QModelIndex index = d->model->index(0, d->column, d->root);
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
QSize step = d->itemSize(option, index);
|
||||
d->commonListView->updateHorizontalScrollBar(step);
|
||||
d->commonListView->updateVerticalScrollBar(step);
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ protected:
|
|||
|
||||
private:
|
||||
int visualIndex(const QModelIndex &index) const;
|
||||
friend class QCommonListViewBase;
|
||||
|
||||
Q_DECLARE_PRIVATE(QListView)
|
||||
Q_DISABLE_COPY(QListView)
|
||||
|
|
|
|||
|
|
@ -483,7 +483,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->viewOptionsV1(); }
|
||||
inline QStyleOptionViewItem QCommonListViewBase::viewOptions() const { return qq->viewOptions(); }
|
||||
inline QWidget *QCommonListViewBase::viewport() const { return dd->viewport; }
|
||||
inline QRect QCommonListViewBase::clipRect() const { return dd->clipRect(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -1473,7 +1473,7 @@ void QTableView::paintEvent(QPaintEvent *event)
|
|||
{
|
||||
Q_D(QTableView);
|
||||
// setup temp variables for the painting
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
const QPoint offset = d->scrollDelayOffset;
|
||||
const bool showGrid = d->showGrid;
|
||||
const int gridSize = showGrid ? 1 : 0;
|
||||
|
|
@ -2352,7 +2352,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->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
|
||||
int hint = 0;
|
||||
QModelIndex index;
|
||||
|
|
@ -2440,7 +2440,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->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
|
||||
int hint = 0;
|
||||
int rowsProcessed = 0;
|
||||
|
|
|
|||
|
|
@ -1472,7 +1472,7 @@ void QTreeView::drawTree(QPainter *painter, const QRegion ®ion) const
|
|||
Q_D(const QTreeView);
|
||||
const QList<QTreeViewItem> viewItems = d->viewItems;
|
||||
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
const QStyle::State state = option.state;
|
||||
d->current = 0;
|
||||
|
||||
|
|
@ -2868,7 +2868,7 @@ int QTreeView::sizeHintForColumn(int column) const
|
|||
return -1;
|
||||
ensurePolished();
|
||||
int w = 0;
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
const QList<QTreeViewItem> viewItems = d->viewItems;
|
||||
|
||||
const int maximumProcessRows = d->header->resizeContentsPrecision(); // To avoid this to take forever.
|
||||
|
|
@ -2980,7 +2980,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const
|
|||
qSwap(end, start);
|
||||
|
||||
int height = -1;
|
||||
QStyleOptionViewItem option = d->viewOptionsV1();
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
// ### If we want word wrapping in the items,
|
||||
// ### we need to go through all the columns
|
||||
// ### and set the width of the column
|
||||
|
|
@ -3252,7 +3252,7 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons
|
|||
painter.end();
|
||||
|
||||
//and now let's render the editors the editors
|
||||
QStyleOptionViewItem option = viewOptionsV1();
|
||||
QStyleOptionViewItem option = q->viewOptions();
|
||||
for (QEditorIndexHash::const_iterator it = editorIndexHash.constBegin(); it != editorIndexHash.constEnd(); ++it) {
|
||||
QWidget *editor = it.key();
|
||||
const QModelIndex &index = it.value();
|
||||
|
|
|
|||
Loading…
Reference in New Issue