Fluid 1.3.0
Material Design for QtQuick and Qml
Loading...
Searching...
No Matches
Fluid::Elevation Class Reference

A QQuickItem that renders elevation-based shadow effects. More...

#include <elevation.h>

Inheritance diagram for Fluid::Elevation:

Signals

void elevationChanged (qreal elevation)
 
void radiusChanged (qreal radius)
 
void topLeftRadiusChanged (qreal topLeftRadius)
 
void topRightRadiusChanged (qreal topRightRadius)
 
void bottomLeftRadiusChanged (qreal bottomLeftRadius)
 
void bottomRightRadiusChanged (qreal bottomRightRadius)
 
void colorChanged (QColor color)
 

Public Member Functions

 Elevation (QQuickItem *parent=nullptr)
 Constructs an Elevation item with an optional parent.
 
 ~Elevation () override
 Destructor for the Elevation item.
 
qreal elevation () const
 Returns the current elevation level.
 
void setElevation (qreal elevation)
 Sets the elevation level.
 
qreal radius () const
 Returns the current radius.
 
void setRadius (qreal newRadius)
 Sets the radius for all corners.
 
qreal topLeftRadius () const
 
void setTopLeftRadius (qreal newTopLeftRadius)
 
qreal topRightRadius () const
 
void setTopRightRadius (qreal newTopRightRadius)
 
qreal bottomLeftRadius () const
 
void setBottomLeftRadius (qreal newBottomLeftRadius)
 
qreal bottomRightRadius () const
 
void setBottomRightRadius (qreal newBottomRightRadius)
 
QColor color () const
 Returns the current shadow color.
 
void setColor (const QColor &newColor)
 Sets the shadow color.
 
void componentComplete () override
 Called when the component is complete.
 

Protected Member Functions

void itemChange (QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override
 Handles item changes.
 
QSGNode * updatePaintNode (QSGNode *node, QQuickItem::UpdatePaintNodeData *data) override
 Updates the paint node for rendering.
 

Properties

qreal elevation
 
qreal radius
 
qreal topLeftRadius
 
qreal topRightRadius
 
qreal bottomLeftRadius
 
qreal bottomRightRadius
 
QColor color
 

Detailed Description

A QQuickItem that renders elevation-based shadow effects.

The Elevation class provides a visual shadow effect that simulates material design elevation. It renders shadows beneath the item based on the specified elevation level, corner radii, and color. The shadow is rendered using a custom scene graph node (ElevationNode) that handles the geometry and material for the shadow effect.

The class supports:

  • Configurable elevation levels that affect shadow intensity and spread
  • Customizable corner radii for rounded shadows
  • Adjustable shadow color and opacity
  • Automatic updates when properties change
Note
This class uses Qt's scene graph API for efficient rendering.
The shadow effect follows Material Design principles with ambient and spot lighting.

Definition at line 16 of file elevation.h.

Constructor & Destructor Documentation

◆ Elevation()

Elevation::Elevation ( QQuickItem *  parentItem = nullptr)

Constructs an Elevation item with an optional parent.

Parameters
parentItemThe parent QQuickItem, if any.

Definition at line 108 of file elevation.cpp.

◆ ~Elevation()

Elevation::~Elevation ( )
override

Destructor for the Elevation item.

Definition at line 123 of file elevation.cpp.

Member Function Documentation

◆ bottomLeftRadius()

qreal Elevation::bottomLeftRadius ( ) const

Definition at line 236 of file elevation.cpp.

◆ bottomLeftRadiusChanged

void Fluid::Elevation::bottomLeftRadiusChanged ( qreal  bottomLeftRadius)
signal

◆ bottomRightRadius()

qreal Elevation::bottomRightRadius ( ) const

Definition at line 253 of file elevation.cpp.

◆ bottomRightRadiusChanged

void Fluid::Elevation::bottomRightRadiusChanged ( qreal  bottomRightRadius)
signal

◆ color()

QColor Elevation::color ( ) const

Returns the current shadow color.

Returns
QColor representing the shadow color.

Definition at line 274 of file elevation.cpp.

◆ colorChanged

void Fluid::Elevation::colorChanged ( QColor  color)
signal

◆ componentComplete()

void Elevation::componentComplete ( )
override

Called when the component is complete.

Definition at line 296 of file elevation.cpp.

◆ elevation()

qreal Elevation::elevation ( ) const

Returns the current elevation level.

Returns
Elevation level as a double.

Definition at line 131 of file elevation.cpp.

◆ elevationChanged

void Fluid::Elevation::elevationChanged ( qreal  elevation)
signal

◆ itemChange()

void Elevation::itemChange ( QQuickItem::ItemChange  change,
const QQuickItem::ItemChangeData &  value 
)
overrideprotected

Handles item changes.

Parameters
changeThe type of change.
valueAdditional data related to the change.

Definition at line 306 of file elevation.cpp.

◆ radius()

qreal Elevation::radius ( ) const

Returns the current radius.

If any individual corner radius has been explicitly set, returns the maximum of all four corner radii. Otherwise returns the uniform radius value.

Returns
Radius as a qreal.

Definition at line 156 of file elevation.cpp.

◆ radiusChanged

void Fluid::Elevation::radiusChanged ( qreal  radius)
signal

◆ setBottomLeftRadius()

void Elevation::setBottomLeftRadius ( qreal  newBottomLeftRadius)

Definition at line 241 of file elevation.cpp.

◆ setBottomRightRadius()

void Elevation::setBottomRightRadius ( qreal  newBottomRightRadius)

Definition at line 258 of file elevation.cpp.

◆ setColor()

void Elevation::setColor ( const QColor &  newColor)

Sets the shadow color.

Parameters
newColorNew QColor for the shadow.

Definition at line 283 of file elevation.cpp.

◆ setElevation()

void Elevation::setElevation ( qreal  l)

Sets the elevation level.

Parameters
lNew elevation level.

Definition at line 140 of file elevation.cpp.

◆ setRadius()

void Elevation::setRadius ( qreal  newRadius)

Sets the radius for all corners.

Clears any individually overridden corner radii, so all four corners will use this value. Individual radii set afterwards will override it.

Parameters
newRadiusNew radius value.

Definition at line 174 of file elevation.cpp.

◆ setTopLeftRadius()

void Elevation::setTopLeftRadius ( qreal  newTopLeftRadius)

Definition at line 207 of file elevation.cpp.

◆ setTopRightRadius()

void Elevation::setTopRightRadius ( qreal  newTopRightRadius)

Definition at line 224 of file elevation.cpp.

◆ topLeftRadius()

qreal Elevation::topLeftRadius ( ) const

Definition at line 202 of file elevation.cpp.

◆ topLeftRadiusChanged

void Fluid::Elevation::topLeftRadiusChanged ( qreal  topLeftRadius)
signal

◆ topRightRadius()

qreal Elevation::topRightRadius ( ) const

Definition at line 219 of file elevation.cpp.

◆ topRightRadiusChanged

void Fluid::Elevation::topRightRadiusChanged ( qreal  topRightRadius)
signal

◆ updatePaintNode()

QSGNode * Elevation::updatePaintNode ( QSGNode *  node,
QQuickItem::UpdatePaintNodeData *  data 
)
overrideprotected

Updates the paint node for rendering.

Parameters
nodeThe existing QSGNode, if any.
dataAdditional data for updating the paint node.
Returns
Updated QSGNode for rendering.

Definition at line 321 of file elevation.cpp.

Property Documentation

◆ bottomLeftRadius

qreal Fluid::Elevation::bottomLeftRadius
readwrite

Definition at line 26 of file elevation.h.

◆ bottomRightRadius

qreal Fluid::Elevation::bottomRightRadius
readwrite

Definition at line 28 of file elevation.h.

◆ color

QColor Fluid::Elevation::color
readwrite

Definition at line 30 of file elevation.h.

◆ elevation

qreal Fluid::Elevation::elevation
readwrite

Definition at line 20 of file elevation.h.

◆ radius

qreal Fluid::Elevation::radius
readwrite

Definition at line 21 of file elevation.h.

◆ topLeftRadius

qreal Fluid::Elevation::topLeftRadius
readwrite

Definition at line 22 of file elevation.h.

◆ topRightRadius

qreal Fluid::Elevation::topRightRadius
readwrite

Definition at line 24 of file elevation.h.


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