Skip to content

UniDeskShadow Type

High-performance shadow control using multiple layered Rectangle items to simulate shadow effects. Several times faster than DropShadow.

ProjectDescription
Control TypeVisual Control
Source FileUniDesk/Controls/UniDeskShadow.qml
InheritsQtQuick Item
QML Importimport UniDesk.Controls 1.0

Custom Properties

PropertyTypeDefaultDescription
colorcolorDark #000000 / Light #999999Shadow color
elevationint5Shadow level (determines thickness and layers)
radiusint4Corner radius

Principle

Uses Repeater to create elevation Rectangle items, each offset by 1px with decreasing opacity:

opacity: 0.01 * (elevation - index + 1)
anchors.margins: -index
border.width: index
radius: radius + index

Example

qml
import UniDesk.Controls 1.0

Rectangle {
    width: 200
    height: 100
    color: "#fff"
    radius: 8

    UniDeskShadow {
        anchors.fill: parent
        elevation: 8
        radius: 8
    }
}

Released under the CC BY-SA 4.0 open documentation license.