mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-06-14 21:01:39 -05:00
Do not trigger resize if section is collapsed
This commit is contained in:
parent
7fda5e3820
commit
fdb72629db
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user