Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
CollapsibleSection Class Reference

A collapsible section widget for use in a QSplitter. More...

#include <collapsible_section.h>

Inheritance diagram for CollapsibleSection:

Signals

void toggled (bool expanded)
 Emitted when the section is toggled.
 

Public Member Functions

 CollapsibleSection (const QString &title=QString(), QWidget *parent=nullptr)
 Construct a collapsible section.
 
void setContentWidget (QWidget *contentWidget)
 Set the content widget for this section.
 
void setExpanded (bool expanded)
 Set the expanded state of the section.
 
bool isExpanded () const
 Check if the section is currently expanded.
 
void setTitle (const QString &title)
 Set the title text.
 
int headerHeight () const
 Get the header height (for splitter sizing when collapsed).
 
int titleButtonHeight () const
 Height of the title / toggle control (single header line).
 
QFont titleButtonFont () const
 Font used for the section title (bold application font).
 
void setHeaderTrailingWidget (QWidget *widget)
 Set an optional widget in the header row after the horizontal rule (order: title, rule, trailing). Pass nullptr to clear. The widget is sized to the title line height. The section takes ownership of widget.
 

Detailed Description

A collapsible section widget for use in a QSplitter.

This widget displays a clickable header that toggles the visibility of the content area. When collapsed, the widget shrinks to just the header height. When expanded, it can be resized via the parent splitter. Multiple CollapsibleSection widgets can be independently expanded or collapsed.

Constructor & Destructor Documentation

◆ CollapsibleSection()

CollapsibleSection::CollapsibleSection ( const QString &  title = QString(),
QWidget *  parent = nullptr 
)
explicit

Construct a collapsible section.

Parameters
titleThe title displayed in the header.
parentOptional parent widget.

Member Function Documentation

◆ headerHeight()

int CollapsibleSection::headerHeight ( ) const

Get the header height (for splitter sizing when collapsed).

Returns
The height of the header in pixels.

◆ isExpanded()

bool CollapsibleSection::isExpanded ( ) const

Check if the section is currently expanded.

Returns
True if expanded, false if collapsed.

◆ setContentWidget()

void CollapsibleSection::setContentWidget ( QWidget *  contentWidget)

Set the content widget for this section.

Parameters
contentWidgetThe widget to display when expanded.

The section takes ownership of the widget.

◆ setExpanded()

void CollapsibleSection::setExpanded ( bool  expanded)

Set the expanded state of the section.

Parameters
expandedTrue to expand, false to collapse.

◆ setHeaderTrailingWidget()

void CollapsibleSection::setHeaderTrailingWidget ( QWidget *  widget)

Set an optional widget in the header row after the horizontal rule (order: title, rule, trailing). Pass nullptr to clear. The widget is sized to the title line height. The section takes ownership of widget.

Parameters
widgetThe widget to show, or nullptr.

◆ setTitle()

void CollapsibleSection::setTitle ( const QString &  title)

Set the title text.

Parameters
titleThe new title.

◆ titleButtonHeight()

int CollapsibleSection::titleButtonHeight ( ) const

Height of the title / toggle control (single header line).

Returns
Pixels, at least 1. Used to size header trailing controls to match.

◆ toggled

void CollapsibleSection::toggled ( bool  expanded)
signal

Emitted when the section is toggled.

Parameters
expandedTrue if now expanded, false if collapsed.

The documentation for this class was generated from the following files: