Improve child list closing.

This commit is contained in:
John Preston 2022-12-06 14:12:43 +04:00
parent 6bd2be0aee
commit a1de77e8d2
3 changed files with 10 additions and 4 deletions

View File

@ -2102,6 +2102,7 @@ void InnerWidget::refreshShownList() {
: session().data().chatsList(_openedFolder)->indexed(); : session().data().chatsList(_openedFolder)->indexed();
if (_shownList != list) { if (_shownList != list) {
_shownList = list; _shownList = list;
_shownList->updateHeights(_narrowRatio);
} }
} }

View File

@ -787,6 +787,7 @@ void Widget::changeOpenedSubsection(
oldContentCache = grabForFolderSlideAnimation(); oldContentCache = grabForFolderSlideAnimation();
} }
_showAnimation = nullptr; _showAnimation = nullptr;
destroyChildListCanvas();
change(); change();
refreshTopBars(); refreshTopBars();
updateControlsVisibility(true); updateControlsVisibility(true);
@ -807,6 +808,11 @@ void Widget::changeOpenedSubsection(
} }
} }
void Widget::destroyChildListCanvas() {
_childListShown = 0.;
_hideChildListCanvas = nullptr;
}
void Widget::changeOpenedFolder(Data::Folder *folder, anim::type animated) { void Widget::changeOpenedFolder(Data::Folder *folder, anim::type animated) {
if (_openedFolder == folder) { if (_openedFolder == folder) {
return; return;
@ -1987,8 +1993,7 @@ void Widget::openChildList(
const auto animated = !_childList const auto animated = !_childList
&& (params.animated == anim::type::normal); && (params.animated == anim::type::normal);
if (animated) { if (animated) {
_childListShown = 0.; destroyChildListCanvas();
_hideChildListCanvas = nullptr;
slide.oldContentCache = Ui::GrabWidget( slide.oldContentCache = Ui::GrabWidget(
this, this,
QRect(_narrowWidth, 0, width() - _narrowWidth, height())); QRect(_narrowWidth, 0, width() - _narrowWidth, height()));
@ -2086,8 +2091,7 @@ void Widget::closeChildList(anim::type animated) {
_hideChildListCanvas->update(); _hideChildListCanvas->update();
}); });
animation->setFinishedCallback([=] { animation->setFinishedCallback([=] {
_childListShown = 0.; destroyChildListCanvas();
_hideChildListCanvas = nullptr;
}); });
animation->setPixmaps(oldContentCache, newContentCache); animation->setPixmaps(oldContentCache, newContentCache);
animation->start(); animation->start();

View File

@ -182,6 +182,7 @@ private:
void changeOpenedFolder(Data::Folder *folder, anim::type animated); void changeOpenedFolder(Data::Folder *folder, anim::type animated);
void changeOpenedForum(Data::Forum *forum, anim::type animated); void changeOpenedForum(Data::Forum *forum, anim::type animated);
void hideChildList(); void hideChildList();
void destroyChildListCanvas();
[[nodiscard]] QPixmap grabForFolderSlideAnimation(); [[nodiscard]] QPixmap grabForFolderSlideAnimation();
void startSlideAnimation( void startSlideAnimation(
QPixmap oldContentCache, QPixmap oldContentCache,