首页 > 代码库 > 在单QTreeWidget如何准确的获得currentItem

在单QTreeWidget如何准确的获得currentItem



QTreeWidgetItem * pCurrentItem = this->itemAt(event->pos() );

event是单击、双击、右键响应函数的参数,如

void CDataTree::contextMenuEvent ( QContextMenuEvent * event )

{

     QTreeWidgetItem * pCurrentItem = this->itemAt(event->pos() );

}

void CDataTree::mouseReleaseEvent(QMouseEvent * event)

{

    QTreeWidgetItem * pCurrentItem = this->itemAt(event->pos() );

}


在单QTreeWidget如何准确的获得currentItem