QHeaderView - fix a logical / visual index mismatch
f9408317e70bc2e635a2f9baeff35d1c06227734 was unfortunately approved though it had an annoying bug. The patch had an assign of a visual index into a logical index. This patch fixes that issue. Change-Id: I9cc75e4e9701858c92e2c3e5817415041b42f8e8 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
This commit is contained in:
parent
12b36aec2b
commit
f1b01b7d15
@ -2450,7 +2450,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
|
|||||||
case QHeaderViewPrivate::SelectSections: {
|
case QHeaderViewPrivate::SelectSections: {
|
||||||
int logical = logicalIndexAt(qMax(-d->offset, pos));
|
int logical = logicalIndexAt(qMax(-d->offset, pos));
|
||||||
if (logical == -1 && pos > 0)
|
if (logical == -1 && pos > 0)
|
||||||
logical = d->lastVisibleVisualIndex();
|
logical = logicalIndex(d->lastVisibleVisualIndex());
|
||||||
if (logical == d->pressed)
|
if (logical == d->pressed)
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
else if (d->pressed != -1)
|
else if (d->pressed != -1)
|
||||||
|
@ -140,10 +140,12 @@ private:
|
|||||||
QTableView *setupTableView()
|
QTableView *setupTableView()
|
||||||
{
|
{
|
||||||
tableView = new QTableView;
|
tableView = new QTableView;
|
||||||
m.setRowCount(500);
|
const int rowCount = 200;
|
||||||
|
m.setRowCount(rowCount);
|
||||||
m.setColumnCount(250);
|
m.setColumnCount(250);
|
||||||
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
tableView->setModel(&m);
|
tableView->setModel(&m);
|
||||||
|
tableView->verticalHeader()->swapSections(rowCount - 1, 5);
|
||||||
return tableView;
|
return tableView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user