Fluid 1.3.0
Material Design for QtQuick and Qml
Loading...
Searching...
No Matches
BadgeOverlay.qml
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// SPDX-License-Identifier: MPL-2.0
3
4pragma ComponentBehavior: Bound
5
6import QtQuick
7import Fluid as MD
8
18MD.Badge {
19 id: control
20
22 required property Item target
23
25 property bool layoutMirrored: mirrored
26
28 readonly property bool targetAvailable: target !== null && target.visible
29 && target.width > 0 && target.height > 0
30
31 readonly property real _horizontalOffset: effectiveVariant === MD.Badge.Small
32 ? MD.Tokens.badge.horizontalOffset : MD.Tokens.badge.largeHorizontalOffset
33 readonly property real _verticalOffset: effectiveVariant === MD.Badge.Small
34 ? MD.Tokens.badge.verticalOffset : MD.Tokens.badge.largeVerticalOffset
35
36 x: target ? (layoutMirrored ? target.x + _horizontalOffset - width
37 : target.x + target.width - _horizontalOffset) : 0
38 y: target ? target.y + _verticalOffset - height : 0
39 visible: targetAvailable
40}