mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
wallpaperselector: Fix delegate dimensions and icon color
The previews in the delegates pop outside of the delegate itself. Fix this, and do some refactoring to simplify the code. Also fix an issue with the "+" delegate not being white.
This commit is contained in:
parent
f537c8f907
commit
1a398d9fdb
1 changed files with 27 additions and 24 deletions
|
|
@ -41,12 +41,12 @@ Controls.Drawer {
|
||||||
anchors.leftMargin: imageWallpaperDrawer.leftMargin
|
anchors.leftMargin: imageWallpaperDrawer.leftMargin
|
||||||
anchors.rightMargin: imageWallpaperDrawer.rightMargin
|
anchors.rightMargin: imageWallpaperDrawer.rightMargin
|
||||||
anchors.bottomMargin: imageWallpaperDrawer.bottomMargin
|
anchors.bottomMargin: imageWallpaperDrawer.bottomMargin
|
||||||
|
|
||||||
orientation: imageWallpaperDrawer.horizontal ? ListView.Vertical : ListView.Horizontal
|
orientation: imageWallpaperDrawer.horizontal ? ListView.Vertical : ListView.Horizontal
|
||||||
keyNavigationEnabled: true
|
keyNavigationEnabled: true
|
||||||
highlightFollowsCurrentItem: true
|
highlightFollowsCurrentItem: true
|
||||||
snapMode: ListView.SnapToItem
|
snapMode: ListView.SnapToItem
|
||||||
model: imageWallpaper.wallpaperModel
|
model: imageWallpaper.wallpaperModel
|
||||||
// onCountChanged: currentIndex = Math.min(model.indexOf(configDialog.wallpaperConfiguration["Image"]), model.rowCount()-1)
|
|
||||||
headerPositioning: ListView.InlineHeader
|
headerPositioning: ListView.InlineHeader
|
||||||
|
|
||||||
header: Controls.ItemDelegate {
|
header: Controls.ItemDelegate {
|
||||||
|
|
@ -60,10 +60,8 @@ Controls.Drawer {
|
||||||
bottomPadding: padding
|
bottomPadding: padding
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
radius: Kirigami.Units.cornerRadius
|
||||||
color: Qt.rgba(255, 255, 255, (openSettings.down || openSettings.highlighted) ? 0.3 : 0.2)
|
color: Qt.rgba(255, 255, 255, (openSettings.down || openSettings.highlighted) ? 0.3 : 0.2)
|
||||||
radius: Kirigami.Units.gridUnit / 4
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Kirigami.Units.gridUnit / 4
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
|
|
@ -72,6 +70,7 @@ Controls.Drawer {
|
||||||
implicitHeight: Kirigami.Units.iconSizes.large
|
implicitHeight: Kirigami.Units.iconSizes.large
|
||||||
implicitWidth: Kirigami.Units.iconSizes.large
|
implicitWidth: Kirigami.Units.iconSizes.large
|
||||||
source: 'list-add'
|
source: 'list-add'
|
||||||
|
color: 'white'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,13 +79,18 @@ Controls.Drawer {
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Controls.ItemDelegate {
|
delegate: Controls.ItemDelegate {
|
||||||
|
id: delegate
|
||||||
|
|
||||||
width: imageWallpaperDrawer.horizontal ? parent.width : height * (imageWallpaperDrawer.width / imageWallpaperDrawer.Screen.height)
|
width: imageWallpaperDrawer.horizontal ? parent.width : height * (imageWallpaperDrawer.width / imageWallpaperDrawer.Screen.height)
|
||||||
height: imageWallpaperDrawer.horizontal ? width / (imageWallpaperDrawer.Screen.width / imageWallpaperDrawer.Screen.height) : parent.height
|
height: imageWallpaperDrawer.horizontal ? width / (imageWallpaperDrawer.Screen.width / imageWallpaperDrawer.Screen.height) : (parent ? parent.height : 0)
|
||||||
padding: wallpapersView.currentIndex === index ? Kirigami.Units.gridUnit / 4 : Kirigami.Units.gridUnit / 2
|
padding: Kirigami.Units.largeSpacing - (ListView.isCurrentItem ? Kirigami.Units.smallSpacing : 0)
|
||||||
leftPadding: padding
|
property real inset: ListView.isCurrentItem ? 0 : Kirigami.Units.smallSpacing
|
||||||
topPadding: padding
|
Behavior on inset {
|
||||||
rightPadding: padding
|
NumberAnimation {
|
||||||
bottomPadding: padding
|
duration: Kirigami.Units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
Behavior on padding {
|
Behavior on padding {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: Kirigami.Units.longDuration
|
duration: Kirigami.Units.longDuration
|
||||||
|
|
@ -94,6 +98,15 @@ Controls.Drawer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
leftPadding: padding
|
||||||
|
topPadding: padding
|
||||||
|
rightPadding: padding
|
||||||
|
bottomPadding: padding
|
||||||
|
topInset: inset
|
||||||
|
bottomInset: inset
|
||||||
|
leftInset: inset
|
||||||
|
rightInset: inset
|
||||||
|
|
||||||
property bool isCurrent: WallpaperImagePlugin.WallpaperPlugin.homescreenWallpaperPath == model.path
|
property bool isCurrent: WallpaperImagePlugin.WallpaperPlugin.homescreenWallpaperPath == model.path
|
||||||
onIsCurrentChanged: {
|
onIsCurrentChanged: {
|
||||||
if (isCurrent) {
|
if (isCurrent) {
|
||||||
|
|
@ -126,20 +139,10 @@ Controls.Drawer {
|
||||||
Keys.onReturnPressed: {
|
Keys.onReturnPressed: {
|
||||||
clicked();
|
clicked();
|
||||||
}
|
}
|
||||||
background: Item {
|
|
||||||
Rectangle {
|
background: Rectangle {
|
||||||
anchors {
|
color: Qt.rgba(255, 255, 255, (delegate.down || delegate.highlighted) ? 0.4 : 0.2)
|
||||||
fill: parent
|
radius: Kirigami.Units.cornerRadius
|
||||||
margins: wallpapersView.currentIndex === index ? 0 : Kirigami.Units.gridUnit / 4
|
|
||||||
Behavior on margins {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Kirigami.Units.longDuration
|
|
||||||
easing.type: Easing.InOutQuad
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
radius: Kirigami.Units.gridUnit / 4
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue