- qDebug() << "e pos :" << e->pos();
- qDebug() << "geo :" << treeWidget_->geometry();
- qDebug() << "Rect :" << treeWidget_->rect();
- qDebug() << "FrameG:" << treeWidget_->frameGeometry();
- qDebug() << "FrameR:" << treeWidget_->frameRect();
- qDebug() << "size :" << treeWidget_->size();
- qDebug() << "posi :" << treeWidget_->pos();
- qDebug() << "normal:" << treeWidget_->normalGeometry();
控制台输出:
e pos : QPoint(81,155)
geo : QRect(33,20 221x151)
Rect : QRect(0,0 221x151)
FrameG: QRect(33,20 221x151)
FrameR: QRect(0,0 221x151)
size : QSize(221,151)
posi : QPoint(33,20)
normal: QRect(0,0 0x0)
e pos为鼠标位置相对与窗体的坐标。
显示了很多个treeWidget_尺寸位置相关接口,却找不到能包含鼠标位置的QRect(即相对于窗口的坐标信息),只得到了相对于Frame的坐标等。
跟文档中的including、excluding不符合???
解决的方法是通过结合Frame的坐标信息得到控件相对于窗口的坐标信息。
[ 此帖被yangfanxing在2010-03-25 20:57重新编辑 ]