LingmoUI 3.1.0
Loading...
Searching...
No Matches
Properties | Private Attributes | List of all members
RadialGradient Class Reference

Draws a radial gradient. More...

Inheritance diagram for RadialGradient:

Properties

bool cached
 
real horizontalOffset
 
real verticalOffset
 
real horizontalRadius
 
real verticalRadius
 
real angle
 
variant source
 
Gradient gradient
 

Private Attributes

SourceProxy maskSourceProxy
 
ShaderEffectSource gradientSource
 
ShaderEffectSource cacheItem
 
ShaderEffect shaderItem
 

Detailed Description

Draws a radial gradient.

\qmltype RadialGradient \inqmlmodule QtGraphicalEffects

Since
QtGraphicalEffects 1.0 \inherits QtQuick2::Item

A gradient is defined by two or more colors, which are blended seamlessly. The colors start from the middle of the item and end at the borders.

\table \header

Member Data Documentation

◆ cacheItem

ShaderEffectSource RadialGradient::cacheItem
private

◆ gradientSource

ShaderEffectSource RadialGradient::gradientSource
private

◆ maskSourceProxy

SourceProxy RadialGradient::maskSourceProxy
private

◆ shaderItem

ShaderEffect RadialGradient::shaderItem
private

Property Documentation

◆ angle

real RadialGradient::angle
read

This property defines the rotation of the gradient around its center point. The rotation is only visible when the \l{RadialGradient::horizontalRadius}{horizontalRadius} and \l{RadialGradient::verticalRadius}{verticalRadius} properties are not equal. The angle is given in degrees and the default value is 0.

\table \header

  • Output examples with different angle values
  • \row
  • \row
  • { angle: 0 }
  • { angle: 45 }
  • { angle: 90 } \row
  • \l horizontalOffset: 0
  • \l horizontalOffset: 0
  • \l horizontalOffset: 0 \row
  • \l verticalOffset: 0
  • \l verticalOffset: 0
  • \l verticalOffset: 0 \row
  • \l horizontalRadius: 100
  • \l horizontalRadius: 100
  • \l horizontalRadius: 100 \row
  • \l verticalRadius: 300
  • \l verticalRadius: 300
  • \l verticalRadius: 300 \endtable

◆ cached

bool RadialGradient::cached
read

This property allows the effect output pixels to be cached in order to improve the rendering performance.

Every time the source or effect properties are changed, the pixels in the cache must be updated. Memory consumption is increased, because an extra buffer of memory is required for storing the effect output.

It is recommended to disable the cache when the source or the effect properties are animated.

By default, the property is set to false.

◆ gradient

Gradient RadialGradient::gradient
read
A gradient is defined by two or more colors, which are blended
seamlessly. The colors are specified as a set of GradientStop child
items, each of which defines a position on the gradient from 0.0 to 1.0
and a color. The position of each GradientStop is defined by setting the
position property. The color is defined by setting the color property.

\table
\header
\li Output examples with different gradient values
\li
\li
\row
    \li \image RadialGradient_gradient1.png
    \li \image RadialGradient_gradient2.png
    \li \image RadialGradient_gradient3.png
\row
    \li \b {gradient:} \code

Gradient { GradientStop { position: 0.000 color: Qt.rgba(1, 0, 0, 1) } GradientStop { position: 0.167 color: Qt.rgba(1, 1, 0, 1) } GradientStop { position: 0.333 color: Qt.rgba(0, 1, 0, 1) } GradientStop { position: 0.500 color: Qt.rgba(0, 1, 1, 1) } GradientStop { position: 0.667 color: Qt.rgba(0, 0, 1, 1) } GradientStop { position: 0.833 color: Qt.rgba(1, 0, 1, 1) } GradientStop { position: 1.000 color: Qt.rgba(1, 0, 0, 1) } }

  • {gradient:}
    Gradient {
    GradientStop {
    position: 0.0
    color: "#F0F0F0"
    }
    GradientStop {
    position: 0.5
    color: "#000000"
    }
    GradientStop {
    position: 1.0
    color: "#F0F0F0"
    }
    }
  • {gradient:}
    Gradient {
    GradientStop {
    position: 0.0
    color: "#00000000"
    }
    GradientStop {
    position: 1.0
    color: "#FF000000"
    }
    }
    \row
  • \l horizontalOffset: 0
  • \l horizontalOffset: 0
  • \l horizontalOffset: 0 \row
  • \l verticalOffset: 0
  • \l verticalOffset: 0
  • \l verticalOffset: 0 \row
  • \l horizontalRadius: 300
  • \l horizontalRadius: 300
  • \l horizontalRadius: 300 \row
  • \l verticalRadius: 300
  • \l verticalRadius: 300
  • \l verticalRadius: 300 \row
  • \l angle: 0
  • \l angle: 0
  • \l angle: 0 \endtable

◆ horizontalOffset

real RadialGradient::horizontalOffset
read

\qmlproperty real RadialGradient::horizontalOffset \qmlproperty real RadialGradient::verticalOffset

The horizontalOffset and verticalOffset properties define the offset in pixels for the center point of the gradient compared to the item center.

The values range from -inf to inf. By default, these properties are set to 0.

\table \header

  • Output examples with different horizontalOffset values
  • \row
  • \row
  • { horizontalOffset: -150 }
  • { horizontalOffset: 0 }
  • { horizontalOffset: 150 } \row
  • \l verticalOffset: 0
  • \l verticalOffset: 0
  • \l verticalOffset: 0 \row
  • \l horizontalRadius: 300
  • \l horizontalRadius: 300
  • \l horizontalRadius: 300 \row
  • \l verticalRadius: 300
  • \l verticalRadius: 300
  • \l verticalRadius: 300 \row
  • \l angle: 0
  • \l angle: 0
  • \l angle: 0 \endtable

◆ horizontalRadius

real RadialGradient::horizontalRadius
read

\qmlproperty real RadialGradient::horizontalRadius \qmlproperty real RadialGradient::verticalRadius

The horizontalRadius and verticalRadius properties define the shape and size of the radial gradient. If the radiuses are equal, the shape of the gradient is a circle. If the horizontal and vertical radiuses differ, the shape is elliptical. The radiuses are given in pixels.

The value ranges from -inf to inf. By default, horizontalRadius is bound to width and verticalRadius is bound to height.

\table \header

  • Output examples with different horizontalRadius values
  • \row
  • \row
  • { horizontalRadius: 300 }
  • { horizontalRadius: 100 } \row
  • \l horizontalOffset: 0
  • \l horizontalOffset: 0 \row
  • \l verticalOffset: 0
  • \l verticalOffset: 0 \row
  • \l verticalRadius: 300
  • \l verticalRadius: 300 \row
  • \l angle: 0
  • \l angle: 0 \row
  • \l gradient: QQuickGradient(0xa05fb10)
  • \l gradient: QQuickGradient(0xa05fb10) \endtable

◆ source

variant RadialGradient::source
read

This property defines the item that is going to be filled with gradient. Source item gets rendered into an intermediate pixel buffer and the alpha values from the result are used to determine the gradient's pixels visibility in the display. The default value for source is undefined and in that case whole effect area is filled with gradient.

\table \header

  • Output examples with different source values
  • \row
  • \row
  • { source: undefined }
  • { source: Image { source: images/butterfly.png } } \row
  • \l horizontalOffset: 0
  • \l horizontalOffset: 0 \row
  • \l verticalOffset: 0
  • \l verticalOffset: 0 \row
  • \l horizontalRadius: 300
  • \l horizontalRadius: 300 \row
  • \l verticalRadius: 300
  • \l verticalRadius: 300 \row
  • \l angle: 0
  • \l angle: 0 \endtable
Note
It is not supported to let the effect include itself, for instance by setting source to the effect's parent.

◆ verticalOffset

real RadialGradient::verticalOffset
read

◆ verticalRadius

real RadialGradient::verticalRadius
read