ShadowStyle QML Type

Defines the drop shadow style for a delegate. More...

Import Statement: import Qt.labs.StyleKit

Properties

Detailed Description

ShadowStyle provides properties for rendering a drop shadow behind a DelegateStyle. It is available as the shadow grouped property on any delegate.

 button {
     background {
         shadow {
             color: "lightgray"
             opacity: 0.6
             verticalOffset: 2
             horizontalOffset: 2
         }
     }
 }

By adjusting scale and color, shadows can also be used to create glow effects. The following snippet adds a diffuse white glow to the handle of a Switch that intensifies when checked:

 dark: Theme {
     applicationWindow.background.color: "#1e1e1e"
     switchControl {
         handle.color: "white"
         handle.shadow {
             color: "ghostwhite"
             scale: 1.2
             opacity: 0.6
         }
         checked.handle.shadow.scale: 1.5
     }
 }

Note: Types in Qt.labs modules are not guaranteed to remain compatible in future versions.

See also DelegateStyle, ControlStyle, ControlStateStyle, and FallbackStyle Reference.

Property Documentation

blur : real

The blur of the shadow. A value of 0.0 produces a sharp shadow, while larger values produce a softer, more diffuse shadow. The default value is 10.0.

color : color

The color of the shadow. The default value is transparent, which means that no shadow will be drawn by default.

See also visible and opacity.

delegate : Component

A custom QML Component that replaces the default shadow rendering. When set, StyleKit instantiates this component instead of drawing the default shadow.

horizontalOffset : real

The horizontal offset of the shadow from the delegate, in pixels.

opacity : real

The opacity of the shadow, from 0.0 (fully transparent) to 1.0 (fully opaque). The default value is 1.0.

See also visible and color.

scale : real

The scale factor of the shadow relative to the delegate. The default value is 1.0.

verticalOffset : real

The vertical offset of the shadow from the delegate, in pixels.

visible : bool

Whether the shadow is visible. The default value is true.

However, since the default shadow color is transparent, the shadow will not be visible unless a different color is set.

See also opacity.