Return value of QHeaderView ::logicalIndexAt is not accurate
Solved
General and Desktop
-
code as below, what's the bug?
void MyTreeView::OnHeaderViewMouseRClick(bool checked) { QHeaderView * hv = header(); QPoint pt = QCursor::pos(); pt = hv->mapFromGlobal(pt); int logical_index = hv->logicalIndexAt(pt); QString s = QString::asprintf("%d", logical_index); QMessageBox::information(this, "info", s); }
-
Hi,
What's the values you get ?
What's the values you expect ? -
@SGaist said in Return value of QHeaderView ::logicalIndexAt is not accurate:
What's the values you get ?
What's the values you expect ?The red sections and indexes are what's I got.
The green sections and indexes are what's expected. -
You should print out
pt
- I would guess x is not 0 when you click on the very left side of the header view.