Warning, /frameworks/qqc2-desktop-style/org.kde.desktop/PageIndicator.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2017 The Qt Company Ltd. 0003 SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com> 0004 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> 0005 0006 SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later 0007 */ 0008 0009 import QtQuick 0010 import QtQuick.Templates as T 0011 import org.kde.kirigami as Kirigami 0012 0013 T.PageIndicator { 0014 id: control 0015 0016 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, 0017 implicitContentWidth + leftPadding + rightPadding) 0018 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, 0019 implicitContentHeight + topPadding + bottomPadding) 0020 0021 padding: Kirigami.Units.largeSpacing 0022 spacing: Kirigami.Units.largeSpacing 0023 0024 // QTBUG-115133: Kirigami/ShadowedRectangle renders smoother circles at HiDPI than plain QtQuick/Rectangle. 0025 delegate: Kirigami.ShadowedRectangle { 0026 required property int index 0027 // `pressed` is a context property, it can't be required in delegate. 0028 0029 implicitWidth: Kirigami.Units.largeSpacing 0030 implicitHeight: Kirigami.Units.largeSpacing 0031 0032 radius: width / 2 0033 color: Kirigami.Theme.textColor 0034 0035 opacity: index === currentIndex ? 1 : pressed ? 0.67 : 0.33 0036 0037 Behavior on opacity { 0038 OpacityAnimator { 0039 duration: Kirigami.Units.shortDuration 0040 } 0041 } 0042 } 0043 0044 // Can't be center-aligned, because (1) an approach of setting x/width 0045 // manually gets overridden by automatic sizing of Control; and 0046 // (2) wrapping in an Item breaks delegates for which T.PageIndicator 0047 // injects `pressed` context property; (3) RowLayout with center 0048 // alignment tends to distribute its items across width, which looks odd, 0049 // and again due to custom C++ magic relying on children index of 0050 // contentItem, we can't insert fillers on the left and right. 0051 contentItem: Row { 0052 LayoutMirroring.enabled: control.mirrored 0053 spacing: control.spacing 0054 0055 Repeater { 0056 model: control.count 0057 delegate: control.delegate 0058 } 0059 } 0060 }