listview: 优化rubberband交互逻辑

This commit is contained in:
Yue-Lan 2023-09-19 09:47:59 +08:00
parent e15632598a
commit 4147f1eb18
1 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ ListView::ListView(QWidget *parent) : QTreeView(parent)
setIconSize(QSize(40, 40));
setMouseTracking(true);//追踪鼠标
m_rubberBand = new QRubberBand(QRubberBand::Shape::Rectangle, this);
m_rubberBand = new QRubberBand(QRubberBand::Shape::Rectangle, this->viewport());
//FIXME: do not create proxy in view itself.
ListViewDelegate *delegate = new ListViewDelegate(this);
@ -441,7 +441,7 @@ void ListView::mouseMoveEvent(QMouseEvent *e)
m_logicRect = logicRect.normalized();
int dx = -horizontalOffset();
int dy = -verticalOffset() + this->header()->height();
int dy = -verticalOffset();
auto realRect = m_logicRect.adjusted(dx, dy, dx ,dy);
if (!m_rubberBand->isVisible())