QTreeView, are pos in customContextMenuRequested and pos in indexAt the same?
-
MyTreeViewis derived fromQTreeViewposinMyTreeView::customContextMenuRequestedis relative toMyTreeView::viewport()For the code snippets below, which one is right?
void MyTreeView::on_myTreeView_customContextMenuRequested(const QPoint &pos) { QModelIndex index = indexAt(pos); }void MyTreeView::on_myTreeView_customContextMenuRequested(const QPoint &pos) { QPoint pos_in_view = mapTo(this, pos); QModelIndex index = indexAt(pos_in_view); } -
MyTreeViewis derived fromQTreeViewposinMyTreeView::customContextMenuRequestedis relative toMyTreeView::viewport()For the code snippets below, which one is right?
void MyTreeView::on_myTreeView_customContextMenuRequested(const QPoint &pos) { QModelIndex index = indexAt(pos); }void MyTreeView::on_myTreeView_customContextMenuRequested(const QPoint &pos) { QPoint pos_in_view = mapTo(this, pos); QModelIndex index = indexAt(pos_in_view); }