跳转至

cf::ui::widget::material::MaterialApplication

Material Design 3 Application class. More...

#include <material_application.h>

Inherits from cf::ui::widget::application_support::Application, QApplication

Public Functions

Name
MaterialApplication(int & argc, char ** argv)
Constructor with standard QApplication arguments.
~MaterialApplication() override
Destructor.
MaterialApplication(constMaterialApplication & ) =delete
MaterialApplication & operator=(constMaterialApplication & ) =delete
MaterialApplication(MaterialApplication && ) =delete
MaterialApplication & operator=(MaterialApplication && ) =delete

Protected Functions

Name
virtual void init() override
Register Material themes and initialize.

Public Attributes

Name
constexprconstchar * DEFAULT_THEME

Additional inherited members

Public Types inherited from cf::ui::widget::application_support::Application

Name
using std::function< std::unique_ptr< components::ICFAnimationManagerFactory >(constcore::ICFTheme &, QObject *)> AnimationFactoryMaker
Animation factory creator function type.

Public Signals inherited from cf::ui::widget::application_support::Application

Name
void themeChanged(constcore::ICFTheme & newTheme)
Signal emitted when the theme changes.
void animationsEnabledChanged(bool enabled)
Signal emitted when animation enabled state changes.

Public Functions inherited from cf::ui::widget::application_support::Application

Name
Application(int & argc, char ** argv)
Constructor with standard QApplication arguments.
~Application() override
Destructor.
Application(constApplication & ) =delete
Application(Application && ) =delete
constcore::ICFTheme & theme(const std::string & themeToken) const
Get a theme by token name.
void setTheme(const std::string & themeToken)
Set the active theme by token.
constcore::ICFTheme & currentTheme() const
Get the current active theme.
cf::WeakPtr< components::ICFAbstractAnimation > animation(const std::string & animationToken)
Get an animation by token name.
void setAnimationsEnabled(bool enabled)
Set global animation enabled state.
bool animationsEnabled() const
Check if animations are globally enabled.
Application * instance()
Get the singleton Application instance.
core::ThemeManager * themeManager()
Get the ThemeManager singleton.
cf::WeakPtr< components::ICFAnimationManagerFactory > animationFactory()
Get the animation factory.
bool registerAnimationFactoryType(const std::string & themePrefix, AnimationFactoryMaker maker)
Register an animation factory type for a theme prefix.
void unregisterAnimationFactoryType(const std::string & themePrefix)
Unregister an animation factory type.

Detailed Description

class cf::ui::widget::material::MaterialApplication;

Material Design 3 Application class.

Exceptions:

  • May throw if theme registration fails.

Since: 0.1

Note: This class registers the material themes automatically.

Warning: Use this instead of Application for Material Design apps.

Extends Application to provide Material Design 3 theme support. Automatically registers Material Design light and dark themes on construction.

int main(int argc, char* argv[]) {
    using namespace cf::ui::widget::material;

    MaterialApplication app(argc, argv);
    app.setTheme("theme.material.light");

    MyWidget w;
    w.show();

    return app.exec();
}

Public Functions Documentation

function MaterialApplication

MaterialApplication(
    int & argc,
    char ** argv
)

Constructor with standard QApplication arguments.

Parameters:

  • argc Argument count (reference for Qt compatibility).
  • argv Argument values.

Exceptions:

  • May throw if theme registration fails.

Since: 0.1

Note: Automatically registers Material Design themes.

Warning: None

MaterialApplication app(argc, argv);

function ~MaterialApplication

~MaterialApplication() override

Destructor.

Since: 0.1

function MaterialApplication

MaterialApplication(
    constMaterialApplication & 
) =delete

function operator=

MaterialApplication & operator=(
    constMaterialApplication & 
) =delete

function MaterialApplication

MaterialApplication(
    MaterialApplication && 
) =delete

function operator=

MaterialApplication & operator=(
    MaterialApplication && 
) =delete

Protected Functions Documentation

function init

virtual void init() override

Register Material themes and initialize.

Since: 0.1

Reimplements: cf::ui::widget::application_support::Application::init

Overrides Application::init() to register Material Design themes before calling base initialization.

Public Attributes Documentation

variable DEFAULT_THEME

static constexprconstchar * DEFAULT_THEME =
        cf::ui::core::token::literals::MATERIAL_THEME_LIGHT;

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