Commit 812dc857 authored by Noah Davis's avatar Noah Davis 🌵
Browse files

[Delegates, MenuItem] Fix disabled colors

somehow -1 works for resetting the colorset
parent be0c2411
......@@ -43,13 +43,7 @@ T.CheckDelegate {
icon.width: Kirigami.Units.iconSizes.auto
icon.height: Kirigami.Units.iconSizes.auto
Kirigami.Theme.colorSet: {
if (control.down || control.highlighted) {
return Kirigami.Theme.Button
} else {
return parent.Kirigami.Theme.colorSet ?? Kirigami.Theme.View
}
}
Kirigami.Theme.colorSet: control.down || control.highlighted ? Kirigami.Theme.Button : -1
Kirigami.Theme.inherit: !background || !background.visible && !(control.highlighted || control.down)
contentItem: IconLabelContent {
......
......@@ -42,13 +42,7 @@ T.ItemDelegate {
icon.width: Kirigami.Units.iconSizes.auto
icon.height: Kirigami.Units.iconSizes.auto
Kirigami.Theme.colorSet: {
if (control.down || control.highlighted) {
return Kirigami.Theme.Button
} else {
return parent.Kirigami.Theme.colorSet ?? Kirigami.Theme.View
}
}
Kirigami.Theme.colorSet: control.down || control.highlighted ? Kirigami.Theme.Button : -1
Kirigami.Theme.inherit: !background || !background.visible && !(control.highlighted || control.down)
contentItem: IconLabelContent {
......
// NOTE: check this
/*
SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2017 The Qt Company Ltd.
......@@ -18,7 +17,7 @@ import "impl"
T.Menu {
id: control
property bool __hasIndicators: false
property bool __hasIcons: false
property bool __hasArrows: false
......@@ -30,19 +29,18 @@ T.Menu {
contentHeight + topPadding + bottomPadding)
margins: 0
overlap: background.border.width
overlap: background && background.hasOwnProperty("border") ? background.border.width : 0
delegate: Controls.MenuItem {
__reserveSpaceForIndicator: control.__hasIndicators
__reserveSpaceForIcon: control.__hasIcons
__reserveSpaceForArrow: control.__hasArrows
}
// The default contentItem is a ListView, which has its own contentItem property,
// so delegates will be created as children of control.contentItem.contentItem
delegate: Controls.MenuItem {}
contentItem: ListView {
implicitHeight: contentHeight
implicitWidth: contentWidth
model: control.contentModel
highlightMoveDuration: Kirigami.Units.shortDuration
// highlightMoveVelocity: contentHeight
highlightMoveVelocity: Kirigami.Units.gridUnit * 20
highlight: ListViewHighlight {
currentIndex: control.currentIndex
count: control.count
......@@ -51,42 +49,21 @@ T.Menu {
// using it causes separators and disabled items to be highlighted
keyNavigationWraps: true
interactive: Window.window
? contentHeight + control.topPadding + control.bottomPadding > Window.window.height
: false
clip: true
// Makes it so you can't drag/flick the list view around unless the menu is taller than the window
interactive: Window.window ? contentHeight + control.topPadding + control.bottomPadding > Window.window.height : false
clip: interactive // Only needed when the ListView can be dragged/flicked
currentIndex: control.currentIndex || 0
ScrollBar.vertical: Controls.ScrollBar {}
}
//Connections {
//target: control.contentItem.contentItem
//function onChildrenChanged()
//{
//for (var i in control.contentItem.contentItem.children) {
//var child = control.contentItem.contentItem.children[i];
//if (child.indicator && child.indicator.visible) {
//control.__hasIndicators = true;
//}
//if (child.contentItem && child.contentItem.hasIcon) {
//control.__hasIcons = true;
//}
//if (child.arrow && child.arrow.visible) {
//control.__hasArrows = true
//}
//}
//}
//}
enter: Transition {
ParallelAnimation {
NumberAnimation {
property: "opacity"
from: 0
to: 1
easing.type: Easing.OutQuad
easing.type: Easing.OutCubic
duration: Kirigami.Units.shortDuration
}
}
......@@ -98,7 +75,7 @@ T.Menu {
property: "opacity"
from: 1
to: 0
easing.type: Easing.OutQuad
easing.type: Easing.InCubic
duration: Kirigami.Units.shortDuration
}
}
......@@ -115,7 +92,7 @@ T.Menu {
width: Kirigami.Units.smallBorder
}
MediumShadow {
LargeShadow {
radius: parent.radius
}
}
......
......@@ -19,13 +19,7 @@ T.MenuItem {
property bool __reserveSpaceForArrow: true
Kirigami.Theme.colorSet: Kirigami.Theme.Button
Kirigami.Theme.colorSet: {
if (control.down || control.highlighted) {
return Kirigami.Theme.Button
} else {
return parent.Kirigami.Theme.colorSet ?? Kirigami.Theme.Window
}
}
Kirigami.Theme.colorSet: control.down || control.highlighted ? Kirigami.Theme.Button : -1
Kirigami.Theme.inherit: !background || !background.visible && !(control.highlighted || control.down)
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
......
......@@ -43,13 +43,7 @@ T.RadioDelegate {
icon.width: Kirigami.Units.iconSizes.auto
icon.height: Kirigami.Units.iconSizes.auto
Kirigami.Theme.colorSet: {
if (control.down || control.highlighted) {
return Kirigami.Theme.Button
} else {
return parent.Kirigami.Theme.colorSet ?? Kirigami.Theme.View
}
}
Kirigami.Theme.colorSet: control.down || control.highlighted ? Kirigami.Theme.Button : -1
Kirigami.Theme.inherit: !background || !background.visible && !(control.highlighted || control.down)
contentItem: IconLabelContent {
......
......@@ -41,13 +41,7 @@ T.SwipeDelegate {
icon.width: Kirigami.Units.iconSizes.auto
icon.height: Kirigami.Units.iconSizes.auto
Kirigami.Theme.colorSet: {
if (control.down || control.highlighted) {
return Kirigami.Theme.Button
} else {
return parent.Kirigami.Theme.colorSet ?? Kirigami.Theme.View
}
}
Kirigami.Theme.colorSet: control.down || control.highlighted ? Kirigami.Theme.Button : -1
Kirigami.Theme.inherit: !background || !background.visible && !(control.highlighted || control.down)
contentItem: IconLabelContent {
......
......@@ -43,13 +43,7 @@ T.SwitchDelegate {
icon.width: Kirigami.Units.iconSizes.auto
icon.height: Kirigami.Units.iconSizes.auto
Kirigami.Theme.colorSet: {
if (control.down || control.highlighted) {
return Kirigami.Theme.Button
} else {
return parent.Kirigami.Theme.colorSet ?? Kirigami.Theme.View
}
}
Kirigami.Theme.colorSet: control.down || control.highlighted ? Kirigami.Theme.Button : -1
Kirigami.Theme.inherit: !background || !background.visible && !(control.highlighted || control.down)
contentItem: IconLabelContent {
......
Supports Markdown
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