summaryrefslogtreecommitdiff
path: root/ui/expandablegroup.h
blob: 770e38945ed363987e5610b565c57fe7bdc05b45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "uitypes.h"
#include <QtWidgets/QLabel>
#include <QtWidgets/QToolButton>
#include <QtCore/QParallelAnimationGroup>
#include <QtCore/QPropertyAnimation>

/*!

    \ingroup uiapi
*/
class BINARYNINJAUIAPI ExpandableGroup : public QWidget
{
	Q_OBJECT

  private:
	QToolButton* m_button;
	QLabel* m_title;
	QParallelAnimationGroup* m_animation;
	QWidget* m_content;
	int m_duration = 100;
	bool m_expanded;

  private Q_SLOTS:
	void toggled(bool expanded);

  Q_SIGNALS:
	void sizeChanged();

  public:
	explicit ExpandableGroup(QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr, bool expanded = false);
	void setupAnimation(QLayout* contentLayout);
	void setTitle(const QString& title) { m_title->setText(title); }
	void toggle(bool expanded);
	bool expanded() { return m_expanded; }
	void setContentExpandable(bool expandable);
};