跳转至

cf::ui::core::MaterialFactory

Material Design 3 Theme Factory. More...

#include <material_factory_class.h>

Inherits from cf::ui::core::ThemeFactory

Public Functions

Name
~MaterialFactory() override =default
virtual std::unique_ptr< ICFTheme > fromName(constchar * name) override
Create theme by name.
virtual std::unique_ptr< ICFTheme > fromJson(constQByteArray & json) override
Create theme from Material Theme Builder JSON.
virtual QByteArray toJson(ICFTheme * raw_theme) override
Export theme to JSON format.

Additional inherited members

Public Functions inherited from cf::ui::core::ThemeFactory

Name
virtual ~ThemeFactory() =default
Virtual destructor.

Detailed Description

class cf::ui::core::MaterialFactory;

Material Design 3 Theme Factory.

Exceptions:

  • None.

Since: 0.1

Note: None.

Warning: None.

Implements ThemeFactory for Material Design 3 themes. Supports:

  • Creating predefined themes by name: "theme.material.light", "theme.material.dark"
  • Creating themes from Material Theme Builder JSON export
  • Exporting themes to JSON format
MaterialFactory factory;

// Create by name
auto lightTheme = factory.fromName("theme.material.light");
auto darkTheme = factory.fromName("theme.material.dark");

// Create from JSON
auto fromJson = factory.fromJson(jsonBytes);

// Export to JSON
auto json = factory.toJson(lightTheme.get());

Public Functions Documentation

function ~MaterialFactory

~MaterialFactory() override =default

function fromName

virtual std::unique_ptr< ICFTheme > fromName(
    constchar * name
) override

Create theme by name.

Parameters:

  • name Theme name:

  • "theme.material.light": Light theme

  • "theme.material.dark": Dark theme

Return: Unique pointer to ICFTheme, or nullptr if name not recognized.

Since: 0.1

Reimplements: cf::ui::core::ThemeFactory::fromName

function fromJson

virtual std::unique_ptr< ICFTheme > fromJson(
    constQByteArray & json
) override

Create theme from Material Theme Builder JSON.

Parameters:

  • json JSON export from Material Theme Builder.

Return: Unique pointer to ICFTheme, or nullptr if parsing fails.

Since: 0.1

Reimplements: cf::ui::core::ThemeFactory::fromJson

function toJson

virtual QByteArray toJson(
    ICFTheme * raw_theme
) override

Export theme to JSON format.

Parameters:

Return: JSON representation of the theme.

Since: 0.1

Reimplements: cf::ui::core::ThemeFactory::toJson


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