Fix: tabs move animation for duplicated tabs (#5426)
* fix: check endValue for running animations only * exit early when move is not needed * ref: remove useless `positionChangedAnimationRunning_` * check for parent notebook visibility instead * ref: rename `pos` param to `targetPos`
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
- Minor: Colored usernames now update on the fly when changing the "Color @usernames" setting. (#5300)
|
- Minor: Colored usernames now update on the fly when changing the "Color @usernames" setting. (#5300)
|
||||||
- Minor: Added `flags.action` filter variable, allowing you to filter on `/me` messages. (#5397)
|
- Minor: Added `flags.action` filter variable, allowing you to filter on `/me` messages. (#5397)
|
||||||
- Minor: Added the ability to duplicate tabs. (#5277)
|
- Minor: Added the ability to duplicate tabs. (#5277)
|
||||||
|
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426)
|
||||||
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
||||||
- Bugfix: Fixed a crash that could occur when logging was enabled in IRC servers that were removed. (#5419)
|
- Bugfix: Fixed a crash that could occur when logging was enabled in IRC servers that were removed. (#5419)
|
||||||
- Dev: Update Windows build from Qt 6.5.0 to Qt 6.7.1. (#5420)
|
- Dev: Update Windows build from Qt 6.5.0 to Qt 6.7.1. (#5420)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "widgets/splits/SplitContainer.hpp"
|
#include "widgets/splits/SplitContainer.hpp"
|
||||||
|
|
||||||
#include <boost/bind/bind.hpp>
|
#include <boost/bind/bind.hpp>
|
||||||
|
#include <QAbstractAnimation>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
@@ -407,22 +408,24 @@ void NotebookTab::hideTabXChanged()
|
|||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookTab::moveAnimated(QPoint pos, bool animated)
|
void NotebookTab::moveAnimated(QPoint targetPos, bool animated)
|
||||||
{
|
{
|
||||||
this->positionAnimationDesiredPoint_ = pos;
|
this->positionAnimationDesiredPoint_ = targetPos;
|
||||||
|
|
||||||
QWidget *w = this->window();
|
if (this->pos() == targetPos)
|
||||||
|
|
||||||
if ((w != nullptr && !w->isVisible()) || !animated ||
|
|
||||||
!this->positionChangedAnimationRunning_)
|
|
||||||
{
|
{
|
||||||
this->move(pos);
|
|
||||||
|
|
||||||
this->positionChangedAnimationRunning_ = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->positionChangedAnimation_.endValue() == pos)
|
if (!animated || !this->notebook_->isVisible())
|
||||||
|
{
|
||||||
|
this->move(targetPos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->positionChangedAnimation_.state() ==
|
||||||
|
QAbstractAnimation::Running &&
|
||||||
|
this->positionChangedAnimation_.endValue() == targetPos)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -430,7 +433,7 @@ void NotebookTab::moveAnimated(QPoint pos, bool animated)
|
|||||||
this->positionChangedAnimation_.stop();
|
this->positionChangedAnimation_.stop();
|
||||||
this->positionChangedAnimation_.setDuration(75);
|
this->positionChangedAnimation_.setDuration(75);
|
||||||
this->positionChangedAnimation_.setStartValue(this->pos());
|
this->positionChangedAnimation_.setStartValue(this->pos());
|
||||||
this->positionChangedAnimation_.setEndValue(pos);
|
this->positionChangedAnimation_.setEndValue(targetPos);
|
||||||
this->positionChangedAnimation_.start();
|
this->positionChangedAnimation_.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
void setHighlightsEnabled(const bool &newVal);
|
void setHighlightsEnabled(const bool &newVal);
|
||||||
bool hasHighlightsEnabled() const;
|
bool hasHighlightsEnabled() const;
|
||||||
|
|
||||||
void moveAnimated(QPoint pos, bool animated = true);
|
void moveAnimated(QPoint targetPos, bool animated = true);
|
||||||
|
|
||||||
QRect getDesiredRect() const;
|
QRect getDesiredRect() const;
|
||||||
void hideTabXChanged();
|
void hideTabXChanged();
|
||||||
@@ -108,7 +108,6 @@ private:
|
|||||||
int normalTabWidthForHeight(int height) const;
|
int normalTabWidthForHeight(int height) const;
|
||||||
|
|
||||||
QPropertyAnimation positionChangedAnimation_;
|
QPropertyAnimation positionChangedAnimation_;
|
||||||
bool positionChangedAnimationRunning_ = false;
|
|
||||||
QPoint positionAnimationDesiredPoint_;
|
QPoint positionAnimationDesiredPoint_;
|
||||||
|
|
||||||
Notebook *notebook_;
|
Notebook *notebook_;
|
||||||
|
|||||||
Reference in New Issue
Block a user