cf::ui::widget::material::base::MdElevationController¶
Material Design elevation controller. More...
#include <elevation_controller.h>
Inherits from QObject
Public Signals¶
| Name | |
|---|---|
| void | pressOffsetChanged() Emitted when the press offset changes during animation. |
Public Functions¶
| Name | |
|---|---|
| MdElevationController(cf::WeakPtr< components::material::CFMaterialAnimationFactory > factory, QObject * parent =nullptr) Constructor with animation factory. |
|
| void | setElevation(int level) Sets the base elevation level. |
| int | elevation() const Gets the current elevation level. |
| void | setLightSourceAngle(float degrees) Sets the light source angle. |
| float | lightSourceAngle() const Gets the light source angle. |
| void | animateTo(int level, constcore::MotionSpec & spec) Animates to a new elevation level. |
| void | paintShadow(QPainter * painter, constQPainterPath & shape) Paints the shadow for a given shape. |
| CFColor | tonalOverlay(CFColor surface, CFColor primary) const Gets the tonal overlay color for dark theme. |
| void | setPressed(bool pressed) Sets the pressed state. |
| void | animatePressOffsetTo(float to) Animates the press offset to a target value. |
| bool | isPressed() const Gets the pressed state. |
| float | pressOffset() const Gets the press offset for the current elevation. |
| ~MdElevationController() Destructor. |
Detailed Description¶
Material Design elevation controller.
Since: N/A
Manages elevation levels and shadow rendering for Material Design widgets. Provides animated transitions between elevation levels and tonal overlay colors for dark theme support.
Public Signals Documentation¶
signal pressOffsetChanged¶
Emitted when the press offset changes during animation.
Exceptions:
- None
Since: N/A
Note: Connect to this signal to trigger repaint when press offset animates.
Warning: None
Public Functions Documentation¶
function MdElevationController¶
explicit MdElevationController(
cf::WeakPtr< components::material::CFMaterialAnimationFactory > factory,
QObject * parent =nullptr
)
Constructor with animation factory.
Parameters:
- factory WeakPtr to the animation factory.
- parent QObject parent.
- factory WeakPtr to animation factory for elevation transitions.
- parent QObject parent for memory management.
Exceptions:
- None
Since: N/A
Note: None
Warning: None
Constructor - initializes elevation controller.
function setElevation¶
Sets the base elevation level.
Parameters:
- level Elevation level (0-5).
Exceptions:
- None
Since: N/A
Note: Material Design defines 6 standard levels (0-5).
Warning: None
function elevation¶
Gets the current elevation level.
Exceptions:
- None
Return: Current elevation level (0-5).
Since: N/A
Note: None
Warning: None
function setLightSourceAngle¶
Sets the light source angle.
Parameters:
- degrees Angle in degrees (positive = right, negative = left).
Exceptions:
- None
Since: N/A
Note: Material Design default is approximately 15 degrees (light from top-left).
Warning: None
function lightSourceAngle¶
Gets the light source angle.
Exceptions:
- None
Return: Light source angle in degrees.
Since: N/A
Note: None
Warning: None
function animateTo¶
Animates to a new elevation level.
Parameters:
- level Target elevation level.
- spec Motion specification for the animation.
Exceptions:
- None
Since: N/A
Note: Used for dynamic elevation changes like FAB press.
Warning: None
function paintShadow¶
Paints the shadow for a given shape.
Parameters:
- painter QPainter to render with.
- shape Shape path to render shadow for.
- painter QPainter instance (must be active).
- shape Path to draw shadow for.
Exceptions:
- None
Since: N/A
Note: Call in paintEvent before drawing the background.
Warning: None
Paints shadow for the given shape.
Uses layered shadow rendering for optimal performance. Each layer is drawn with decreasing offset and blur.
function tonalOverlay¶
Gets the tonal overlay color for dark theme.
Parameters:
- surface Base surface color.
- primary Primary color for overlay calculation.
- surface Base surface color.
- primary Primary color for tonal overlay.
Exceptions:
- None
Return:
- Tonal overlay color.
- Tonal overlay color.
Since: N/A
Note: Used in dark theme to indicate elevation level.
Warning: None
Calculates tonal overlay color for dark theme elevation.
In dark theme, elevation is indicated by adding tonal color from the primary palette to the surface.
function setPressed¶
Sets the pressed state.
Parameters:
- pressed true to set pressed state, false otherwise.
Exceptions:
- None
Since: N/A
Note: Pressed state increases elevation visually.
Warning: None
function animatePressOffsetTo¶
Animates the press offset to a target value.
Parameters:
- to Target press offset value.
Exceptions:
- None
Since: N/A
Note: Uses the animation factory for smooth transition.
Warning: None
function isPressed¶
Gets the pressed state.
Exceptions:
- None
Return: true if pressed, false otherwise.
Since: N/A
Note: None
Warning: None
function pressOffset¶
Gets the press offset for the current elevation.
Exceptions:
- None
Return: Press offset in pixels.
Since: N/A
Note: Returns the animated press offset value.
Warning: None
function ~MdElevationController¶
Destructor.
Exceptions:
- None
Since: N/A
Note: None
Warning: None
Destructor - cancels any running animation.
Cancels any running animation before destruction.
Updated on 2026-03-09 at 10:14:01 +0000