跳转至

cf::ui::widget::material::GroupBox

Material Design 3 GroupBox widget. More...

#include <groupbox.h>

Inherits from QGroupBox

Public Functions

Name
GroupBox(QWidget * parent =nullptr)
Constructor.
GroupBox(constQString & title, QWidget * parent =nullptr)
Constructor with title.
~GroupBox() override
Destructor.
int elevation() const
Gets the elevation level.
void setElevation(int level)
Sets the elevation level.
float cornerRadius() const
Gets the effective corner radius.
void setCornerRadius(float radius)
Sets the corner radius.
bool hasBorder() const
Gets whether the group box has a border.
void setHasBorder(bool hasBorder)
Sets whether the group box has a border.
QSize sizeHint() const override
Gets the recommended size.
QSize minimumSizeHint() const override
Gets the minimum recommended size.

Protected Functions

Name
void paintEvent(QPaintEvent * event) override
Paints the group box.
void childEvent(QChildEvent * event) override
Handles child event.
void changeEvent(QEvent * event) override
Handles widget change event.
void resizeEvent(QResizeEvent * event) override
Handles resize event.

Public Properties

Name
int elevation
float cornerRadius
bool hasBorder

Detailed Description

class cf::ui::widget::material::GroupBox;

Material Design 3 GroupBox widget.

Since: 0.1

Implements Material Design 3 group box with rounded corners, optional elevation shadows, and theme-aware colors. Provides a container for grouping related widgets with a title.

Public Functions Documentation

function GroupBox

explicit GroupBox(
    QWidget * parent =nullptr
)

Constructor.

Parameters:

  • parent QObject parent.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function GroupBox

explicit GroupBox(
    constQString & title,
    QWidget * parent =nullptr
)

Constructor with title.

Parameters:

  • title Group box title.
  • parent QObject parent.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function ~GroupBox

~GroupBox() override

Destructor.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function elevation

int elevation() const

Gets the elevation level.

Exceptions:

  • None

Return: Elevation level (0-5).

Since: 0.1

Note: Material Design defines 6 standard levels.

Warning: None

function setElevation

void setElevation(
    int level
)

Sets the elevation level.

Parameters:

  • level Elevation level (0-5).

Exceptions:

  • None

Since: 0.1

Note: Affects shadow rendering.

Warning: None

function cornerRadius

float cornerRadius() const

Gets the effective corner radius.

Exceptions:

  • None

Return: Corner radius in pixels. Returns 0 for default (auto-calculate).

Since: 0.1

Note: Default is based on Material Design shape scale (ShapeSmall).

Warning: None

function setCornerRadius

void setCornerRadius(
    float radius
)

Sets the corner radius.

Parameters:

  • radius Corner radius in pixels.

Exceptions:

  • None

Since: 0.1

Note: Value is clamped to valid range.

Warning: None

function hasBorder

bool hasBorder() const

Gets whether the group box has a border.

Exceptions:

  • None

Return: true if border is enabled, false otherwise.

Since: 0.1

Note: Default is true.

Warning: None

function setHasBorder

void setHasBorder(
    bool hasBorder
)

Sets whether the group box has a border.

Parameters:

  • hasBorder true to enable border, false to disable.

Exceptions:

  • None

Since: 0.1

Note: When disabled, only shadow is drawn (if elevation > 0).

Warning: None

function sizeHint

QSize sizeHint() const override

Gets the recommended size.

Exceptions:

  • None

Return: Recommended size for the group box.

Since: 0.1

Note: Based on content and margins.

Warning: None

function minimumSizeHint

QSize minimumSizeHint() const override

Gets the minimum recommended size.

Exceptions:

  • None

Return: Minimum recommended size.

Since: 0.1

Note: Ensures minimum content size.

Warning: None

Protected Functions Documentation

function paintEvent

void paintEvent(
    QPaintEvent * event
) override

Paints the group box.

Parameters:

  • event Paint event.

Exceptions:

  • None

Since: 0.1

Note: Implements Material Design paint pipeline.

Warning: None

function childEvent

void childEvent(
    QChildEvent * event
) override

Handles child event.

Parameters:

  • event Child event.

Exceptions:

  • None

Since: 0.1

Note: Used to detect layout changes.

Warning: None

function changeEvent

void changeEvent(
    QEvent * event
) override

Handles widget change event.

Parameters:

  • event Change event.

Exceptions:

  • None

Since: 0.1

Note: Updates title tracking when title changes.

Warning: None

function resizeEvent

void resizeEvent(
    QResizeEvent * event
) override

Handles resize event.

Parameters:

  • event Resize event.

Exceptions:

  • None

Since: 0.1

Note: Updates content margins on resize.

Warning: None

Public Property Documentation

property elevation

int elevation;

property cornerRadius

float cornerRadius;

property hasBorder

bool hasBorder;

Updated on 2026-03-09 at 10:14:00 +0000