Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
expanding_widget.h
1#pragma once
2
3#include <QHBoxLayout>
4#include <QLineEdit>
5#include <QPropertyAnimation>
6#include <QPushButton>
7#include <QWidget>
8
9#include "collapsible_area.h"
10
11class ClickableIcon;
12
16class ExpandingWidget : public QWidget
17{
18 Q_OBJECT
19
20public:
24 enum class Direction
25 {
26 Up,
27 Right,
28 Left
29 };
30
37 ExpandingWidget(Direction direction, QWidget* parent = nullptr);
38
44 void setButtonIcon(const QIcon& icon);
45
51 void setButtonTooltip(const QString& tooltip);
52
58 void addCollapsableWidget(QWidget* widget, const QString& label = "");
59
65 void setExpandedSize(int size);
66
70 void expandArea();
71
75 void collapseArea();
76
77 QVBoxLayout* getContent() const;
78
79signals:
85 void textChanged(const QString& text);
86
93
100
101public slots:
107 void setExpanded(bool expanded);
108
109protected:
110 void resizeEvent(QResizeEvent* event) override;
111
112private:
113 ClickableIcon* mButton;
114 QWidget* mSearchArea;
115 QWidget* mContentWidget;
116 QPropertyAnimation* mAnimation;
117
119 int mExpandedSize;
120
121 void setupVerticalWidget();
122 void setupHorizontalWidget();
123
124 void updateCrossAxisSize();
125 void updateContentGeometry();
126};
A clickable icon widget that can be checked or unchecked.
Definition clickable_icon.h:10
void textChanged(const QString &text)
Emitted when the text changes.
void addCollapsableWidget(QWidget *widget, const QString &label="")
Adds a collapsible widget to the expanding area.
Definition expanding_widget.cpp:154
Direction
Enumerates the possible directions for expanding and collapsing.
Definition expanding_widget.h:25
ExpandingWidget(Direction direction, QWidget *parent=nullptr)
Constructs an ExpandingWidget with a specified direction.
Definition expanding_widget.cpp:8
void areaExpanded(ClickableIcon *button)
Emitted when the area is expanded.
QWidget * mSearchArea
Pointer to the button that controls expansion/collapse.
Definition expanding_widget.h:114
void setButtonTooltip(const QString &tooltip)
Sets the tooltip for the button that controls the expansion/collapse.
Definition expanding_widget.cpp:145
void setExpanded(bool expanded)
Sets whether the area is expanded or collapsed.
Definition expanding_widget.cpp:173
Direction mDirection
Pointer to the property animation for expanding/collapsing.
Definition expanding_widget.h:118
QWidget * mContentWidget
Pointer to the collapsible area widget.
Definition expanding_widget.h:115
void setButtonIcon(const QIcon &icon)
Sets the icon for the button that controls the expansion/collapse.
Definition expanding_widget.cpp:139
void setExpandedSize(int size)
Sets the size of the expanded state. The height in vertical mode, the width in horizontal mode.
Definition expanding_widget.cpp:111
void setupVerticalWidget()
The width of the expanded state.
Definition expanding_widget.cpp:31
void areaCollapsed(ClickableIcon *button)
Emitted when the area is collapsed.
QPropertyAnimation * mAnimation
Pointer to the actual content inside the mCollapsibleArea.
Definition expanding_widget.h:116
void collapseArea()
Collapses the area controlled by the button.
Definition expanding_widget.cpp:103
void expandArea()
Expands the area controlled by the button.
Definition expanding_widget.cpp:95