Skip to content

Commit

Permalink
fix: Fix the issue that causes the wrong toolbar thumbnail movable range
Browse files Browse the repository at this point in the history
shorten the toolbar thumbnail vovable range and the animation of recoverey

Log: Fix the issue that toolbar thumbnail movable range is wrong.
Bug: https://pms.uniontech.com/bug-view-158443.html
  • Loading branch information
rb-union authored and lJxDabab committed Jan 17, 2024
1 parent 87637ab commit ad4cfe2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions libimageviewer/viewpanel/contents/imgviewwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ DWIDGET_USE_NAMESPACE

//const int Distance_factor = 4;//距离因子


MyImageListWidget::MyImageListWidget(QWidget *parent)
: QWidget(parent)
{
Expand Down Expand Up @@ -123,7 +124,12 @@ bool MyImageListWidget::eventFilter(QObject *obj, QEvent *e)
m_movePoints.pop_front();
m_movePoints.push_back(p);
}
m_listview->move(m_listview->x() + p.x() - m_moveViewPoint.x(), m_listview->y());
int moveRangeX = m_listview->x() + p.x() - m_moveViewPoint.x();
int rowWidth = m_listview->getRowWidth();
int offsetRowMove = rowWidth - ((rowWidth / 35) > 14 ? 12 : (rowWidth / 35 - 3)) * 35;
moveRangeX = moveRangeX > 60 ? 60 : moveRangeX;
moveRangeX = moveRangeX < (60 - offsetRowMove) ? (60 - offsetRowMove) : moveRangeX;
m_listview->move(moveRangeX, m_listview->y());
m_moveViewPoint = p;

//目的为了获取moveX的值,中心离当前位置的差值
Expand Down Expand Up @@ -342,7 +348,11 @@ void MyImageListWidget::animationStart(bool isReset, int endPos, int duration)
}
m_resetAnimation->setEasingCurve(QEasingCurve::OutQuad);
m_resetAnimation->setStartValue(m_listview->pos());
m_resetAnimation->setEndValue(QPoint(m_listview->pos().x() + moveX, m_listview->pos().y()));
int moveRangeX = m_listview->pos().x() + moveX;
int offsetRowMove = rowWidth - ((rowWidth / 35) >= 12 ? 9 : (rowWidth / 35 - 3)) * 35;
moveRangeX = moveRangeX > 60 ? 60 : moveRangeX;
moveRangeX = moveRangeX < (60 - offsetRowMove) ? (60 - offsetRowMove) : moveRangeX;
m_resetAnimation->setEndValue(QPoint(moveRangeX, m_listview->pos().y()));
m_resetAnimation->start();

}
Expand Down

0 comments on commit ad4cfe2

Please sign in to comment.