leocad/common/lc_collapsiblewidget.h

49 lines
796 B
C
Raw Normal View History

2021-01-07 02:45:38 +01:00
#pragma once
class lcCollapsibleWidgetButton : public QToolButton
2021-01-07 02:45:38 +01:00
{
Q_OBJECT
public:
lcCollapsibleWidgetButton(const QString& Title, QWidget* Parent = nullptr);
2021-01-07 02:45:38 +01:00
void Collapse();
bool IsExpanded() const
{
return mExpanded;
}
signals:
void StateChanged(bool Expanded);
2021-01-07 02:45:38 +01:00
protected slots:
void Clicked();
2021-01-07 02:45:38 +01:00
protected:
void UpdateIcon();
bool mExpanded = true;
static QImage mExpandedIcon;
static QImage mCollapsedIcon;
};
class lcCollapsibleWidget : public QWidget
{
Q_OBJECT
public:
lcCollapsibleWidget(const QString& RootTitle, QWidget* Parent = nullptr);
void Collapse();
void SetChildLayout(QLayout* Layout);
protected slots:
void ButtonStateChanged(bool Expanded);
protected:
lcCollapsibleWidgetButton* mTitleButton = nullptr;
QWidget* mChildWidget = nullptr;
};