Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
SectionWidget Class Reference

A widget that represents a section with a collapsible content area. More...

#include <section.h>

Inheritance diagram for SectionWidget:

Public Member Functions

 SectionWidget (QWidget *parent=nullptr)
 Constructs a new SectionWidget.
void addItem (QWidget *container, const QString &title)
 Adds an item to the section with a title.
void addItem (QWidget *container, const QString &title, oclero::qlementine::TextRole role)
 Adds an item to the section with a title and text role.
void setExpanded (bool expanded)
 Sets whether the section is expanded or collapsed.
bool isExpanded () const
 Returns whether the section is currently expanded.
void setDuration (int duration)
 Sets the duration of the animation for expanding and collapsing.
QWidget * content () const
 Returns the content widget of the section.
void updateContentHeight (int height)
 Updates the height of the content area.

Private Member Functions

int getAnimationDuration (int target, int current) const
 Pointer to the property animation.
void toggled (bool checked)
 Slot called when the toggle button is toggled.

Private Attributes

QWidget * mContent = nullptr
 Pointer to the toggle button for expanding/collapsing.
CollapsibleAreaHeight * mContentArea = nullptr
 Pointer to the content widget.
bool mExpanded = true
 Pointer to the collapsible area.
std::optional< int > mDuration = std::nullopt
 Current state of the section (expanded or collapsed).
QPropertyAnimation * mAnimation = nullptr
 Duration of the animation for expanding and collapsing.

Detailed Description

A widget that represents a section with a collapsible content area.

Constructor & Destructor Documentation

◆ SectionWidget()

SectionWidget::SectionWidget ( QWidget * parent = nullptr)

Constructs a new SectionWidget.

Parameters
parentThe parent widget.

Member Function Documentation

◆ addItem() [1/2]

void SectionWidget::addItem ( QWidget * container,
const QString & title )

Adds an item to the section with a title.

Parameters
containerThe widget to add as content.
titleThe title of the item.

◆ addItem() [2/2]

void SectionWidget::addItem ( QWidget * container,
const QString & title,
oclero::qlementine::TextRole role )

Adds an item to the section with a title and text role.

Parameters
containerThe widget to add as content.
titleThe title of the item.
roleThe text role for the title.

◆ content()

QWidget * SectionWidget::content ( ) const

Returns the content widget of the section.

Returns
The content widget.

◆ getAnimationDuration()

int SectionWidget::getAnimationDuration ( int target,
int current ) const
inlineprivate

Pointer to the property animation.

Calculates the duration of the animation based on target and current heights.

Parameters
targetThe target height.
currentThe current height.
Returns
The calculated duration in milliseconds.

◆ isExpanded()

bool SectionWidget::isExpanded ( ) const

Returns whether the section is currently expanded.

Returns
True if expanded, false otherwise.

◆ setDuration()

void SectionWidget::setDuration ( int duration)

Sets the duration of the animation for expanding and collapsing.

Parameters
durationThe duration in milliseconds.

◆ setExpanded()

void SectionWidget::setExpanded ( bool expanded)

Sets whether the section is expanded or collapsed.

Parameters
expandedTrue to expand, false to collapse.

◆ toggled()

void SectionWidget::toggled ( bool checked)
private

Slot called when the toggle button is toggled.

Parameters
checkedTrue if the button is checked (expanded), false otherwise.

◆ updateContentHeight()

void SectionWidget::updateContentHeight ( int height)

Updates the height of the content area.

Parameters
heightThe new height in pixels.

The documentation for this class was generated from the following files:
  • /__w/maki/maki/app/widgets/section.h
  • /__w/maki/maki/app/widgets/section.cpp