Commit 00fc43a2 authored by Noah Davis's avatar Noah Davis 🌵

Enable hover effects by default

This makes it so we don't have to set `hoverEnabled: true` in Qt Quick Controls
parent 6e81914a
......@@ -143,7 +143,11 @@ KHintsSettings::KHintsSettings(KSharedConfig::Ptr kdeglobals)
m_hints[QPlatformTheme::DialogButtonBoxButtonsHaveIcons] = readConfigValue(cg, QStringLiteral("ShowIconsOnPushButtons"), true);
m_hints[QPlatformTheme::UseFullScreenForPopupMenu] = true;
m_hints[QPlatformTheme::KeyboardScheme] = QPlatformTheme::KdeKeyboardScheme;
m_hints[QPlatformTheme::UiEffects] = readConfigValue(cg, QStringLiteral("GraphicEffectsLevel"), 0) != 0 ? QPlatformTheme::GeneralUiEffect : 0;
int uiEffectsFlags = readConfigValue(cg, QStringLiteral("GraphicEffectsLevel"), 0) != 0 ? QPlatformTheme::GeneralUiEffect : 0;
uiEffectsFlags |= QPlatformTheme::HoverEffect;
m_hints[QPlatformTheme::UiEffects] = uiEffectsFlags;
m_hints[QPlatformTheme::IconPixmapSizes] = QVariant::fromValue(QList<int>() << 512 << 256 << 128 << 64 << 32 << 22 << 16 << 8);
m_hints[QPlatformTheme::WheelScrollLines] = readConfigValue(cg, QStringLiteral("WheelScrollLines"), 3);
......
/*
* SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.12
import QtQuick.Templates 2.12
ApplicationWindow {
width: control.implicitWidth + gridUnit*4
height: control.implicitHeight + gridUnit*4
color: "white"
property int gridUnit: fontMetrics.height
FontMetrics {
id: fontMetrics
}
Button {
id: control
implicitWidth: Math.round(Math.max(implicitContentWidth + leftPadding + rightPadding))
implicitHeight: Math.round(Math.max(implicitContentHeight + topPadding + bottomPadding))
anchors.centerIn: parent
padding: 8
// This is the default behavior, I'm just making it explicit.
hoverEnabled: Qt.styleHints.useHoverEffects
text: "There should be a red outline hover effect on this button"
contentItem: Label {
text: control.text
font: control.font
color: "white"
}
background: Rectangle {
radius: 3
color: "black"
border.color: "red"
// When the useHoverEffects style hint is true, the hover effect should work
border.width: control.hovered ? 4 : 0
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment