Warning, /plasma/plasma-integration/qt6/tests/HoverEffectTest.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 import QtQuick 2.12
0007 import QtQuick.Templates 2.12
0008 
0009 ApplicationWindow {
0010     width: control.implicitWidth + gridUnit*4
0011     height: control.implicitHeight + gridUnit*4
0012     color: "white"
0013 
0014     property int gridUnit: fontMetrics.height
0015 
0016     FontMetrics {
0017         id: fontMetrics
0018     }
0019 
0020     Button {
0021         id: control
0022 
0023         implicitWidth: Math.round(Math.max(implicitContentWidth + leftPadding + rightPadding))
0024         implicitHeight: Math.round(Math.max(implicitContentHeight + topPadding + bottomPadding))
0025 
0026         anchors.centerIn: parent
0027 
0028         padding: 8
0029 
0030         // This is the default behavior, I'm just making it explicit.
0031         hoverEnabled: Qt.styleHints.useHoverEffects
0032 
0033         text: "There should be a red outline hover effect on this button"
0034 
0035         contentItem: Label {
0036             text: control.text
0037             font: control.font
0038             color: "white"
0039         }
0040 
0041         background: Rectangle {
0042             radius: 3
0043             color: "black"
0044             border.color: "red"
0045             // When the useHoverEffects style hint is true, the hover effect should work
0046             border.width: control.hovered ? 4 : 0
0047         }
0048     }
0049 }