SceneSwitcher/lib/utils/section.hpp
WarmUpTill f3e7eaf212
Some checks failed
debian-build / build (push) Waiting to run
Push to master / Check Formatting 🔍 (push) Waiting to run
Push to master / Build Project 🧱 (push) Waiting to run
Push to master / Create Release 🛫 (push) Blocked by required conditions
Check locale / ubuntu64 (push) Has been cancelled
Rework to support frequently resizing widgets
2025-07-13 18:17:46 +02:00

50 lines
1.1 KiB
C++

#pragma once
#include <QFrame>
#include <QGridLayout>
#include <QParallelAnimationGroup>
#include <QToolButton>
#include <QWidget>
namespace advss {
class Section : public QWidget {
Q_OBJECT
public:
explicit Section(const int animationDuration = 300,
QWidget *parent = 0);
void SetContent(QWidget *w);
void SetContent(QWidget *w, bool collapsed);
void AddHeaderWidget(QWidget *);
void SetCollapsed(bool);
private slots:
void AnimationFinish();
void Collapse(bool collapse);
signals:
void AnimationFinished();
void Collapsed(bool);
private:
void SetupAnimations();
void CleanUpPreviousContent();
QGridLayout *_mainLayout;
QHBoxLayout *_headerWidgetLayout;
QToolButton *_toggleButton;
QFrame *_headerLine;
QParallelAnimationGroup *_toggleAnimation = nullptr;
QParallelAnimationGroup *_contentAnimation = nullptr;
QWidget *_contentArea = nullptr;
QWidget *_content = nullptr;
int _animationDuration;
std::atomic_bool _transitioning = {false};
std::atomic_bool _collapsed = {false};
int _headerHeight = 0;
int _contentHeight = 0;
};
} // namespace advss