diff --git a/src/headers/section.hpp b/src/headers/section.hpp index 9dea41b2..b3a1ef2b 100644 --- a/src/headers/section.hpp +++ b/src/headers/section.hpp @@ -38,6 +38,7 @@ private: QWidget *_content = nullptr; int _animationDuration; std::atomic_bool _transitioning = {false}; + std::atomic_bool _collapsed = {false}; int _headerHeight = 0; int _contentHeight = 0; }; diff --git a/src/section.cpp b/src/section.cpp index c76b6800..c06a37dc 100644 --- a/src/section.cpp +++ b/src/section.cpp @@ -49,6 +49,7 @@ void Section::Collapse(bool collapse) ? QAbstractAnimation::Forward : QAbstractAnimation::Backward); _transitioning = true; + _collapsed = collapse; _toggleAnimation->start(); } @@ -93,7 +94,7 @@ void Section::AddHeaderWidget(QWidget *w) bool Section::eventFilter(QObject *obj, QEvent *event) { - if (event->type() == QEvent::Resize && !_transitioning) { + if (event->type() == QEvent::Resize && !_transitioning && !_collapsed) { _contentHeight = _content->sizeHint().height(); setMaximumHeight(_headerHeight + _contentHeight); setMinimumHeight(_headerHeight + _contentHeight);