Commit 6c999209 authored by Alexander Stippich's avatar Alexander Stippich
Browse files

rework sizing of the grid delegate

parent 366adde0
...@@ -89,9 +89,7 @@ Item { ...@@ -89,9 +89,7 @@ Item {
property int navigationBarHeight: 100 property int navigationBarHeight: 100
property int navigationBarFilterHeight: 44 property int navigationBarFilterHeight: 44
property real gridDelegateThumbnail: 0.85 property int gridDelegateSize: 170
property int gridDelegateHeight: 170 * gridDelegateThumbnail + layoutVerticalMargin
property int gridDelegateWidth: 170
property int viewSelectorDelegateHeight: 24 property int viewSelectorDelegateHeight: 24
......
...@@ -140,12 +140,11 @@ FocusScope { ...@@ -140,12 +140,11 @@ FocusScope {
} }
} }
cellWidth: Math.floor(availableWidth / Math.max(Math.floor(availableWidth / elisaTheme.gridDelegateWidth), 2)) cellWidth: Math.floor(availableWidth / Math.max(Math.floor(availableWidth / elisaTheme.gridDelegateSize), 2))
cellHeight: elisaTheme.gridDelegateHeight + cellHeight: elisaTheme.gridDelegateSize + secondaryLabelSize.boundingRect.height * 2 + elisaTheme.layoutVerticalMargin * 2
(secondaryLabelSize.boundingRect.height - secondaryLabelSize.boundingRect.y)
delegate: GridBrowserDelegate { delegate: GridBrowserDelegate {
width: elisaTheme.gridDelegateWidth width: elisaTheme.gridDelegateSize
height: contentDirectoryView.cellHeight height: contentDirectoryView.cellHeight
focus: true focus: true
......
...@@ -83,15 +83,12 @@ FocusScope { ...@@ -83,15 +83,12 @@ FocusScope {
radius: 3 radius: 3
} }
ColumnLayout {
anchors.fill: parent
z: 2
spacing: 0
MouseArea { MouseArea {
id: hoverHandle id: hoverHandle
anchors.fill: parent
z: 2
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
...@@ -123,8 +120,10 @@ FocusScope { ...@@ -123,8 +120,10 @@ FocusScope {
anchors.fill: parent anchors.fill: parent
Item { Item {
Layout.preferredHeight: gridEntry.width * elisaTheme.gridDelegateThumbnail
Layout.preferredWidth: gridEntry.width * elisaTheme.gridDelegateThumbnail Layout.margins: 2 * elisaTheme.layoutVerticalMargin
Layout.preferredHeight: gridEntry.width - 4 * elisaTheme.layoutVerticalMargin
Layout.preferredWidth: gridEntry.width - 4 * elisaTheme.layoutVerticalMargin
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
...@@ -317,7 +316,6 @@ FocusScope { ...@@ -317,7 +316,6 @@ FocusScope {
// See https://bugreports.qt.io/browse/QTBUG-49646 // See https://bugreports.qt.io/browse/QTBUG-49646
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
Layout.topMargin: elisaTheme.layoutVerticalMargin * 0.5
Layout.maximumWidth: gridEntry.width * 0.9 Layout.maximumWidth: gridEntry.width * 0.9
Layout.minimumWidth: Layout.maximumWidth Layout.minimumWidth: Layout.maximumWidth
Layout.maximumHeight: delegateDisplaySecondaryText Layout.maximumHeight: delegateDisplaySecondaryText
...@@ -327,6 +325,7 @@ FocusScope { ...@@ -327,6 +325,7 @@ FocusScope {
Layout.bottomMargin: delegateDisplaySecondaryText ? 0 : elisaTheme.layoutVerticalMargin Layout.bottomMargin: delegateDisplaySecondaryText ? 0 : elisaTheme.layoutVerticalMargin
wrapMode: delegateDisplaySecondaryText ? Label.NoWrap : Label.Wrap wrapMode: delegateDisplaySecondaryText ? Label.NoWrap : Label.Wrap
maximumLineCount: 2
elide: Text.ElideRight elide: Text.ElideRight
} }
...@@ -350,13 +349,12 @@ FocusScope { ...@@ -350,13 +349,12 @@ FocusScope {
elide: Text.ElideRight elide: Text.ElideRight
} }
}
}
Item { Item {
Layout.fillHeight: true Layout.fillHeight: true
} }
} }
}
states: [ states: [
State { State {
......
...@@ -125,13 +125,11 @@ FocusScope { ...@@ -125,13 +125,11 @@ FocusScope {
anchors.fill: contentDirectoryView anchors.fill: contentDirectoryView
} }
cellWidth: Math.floor(availableWidth / Math.max(Math.floor(availableWidth / elisaTheme.gridDelegateWidth), 2)) cellWidth: Math.floor(availableWidth / Math.max(Math.floor(availableWidth / elisaTheme.gridDelegateSize), 2))
cellHeight: elisaTheme.gridDelegateHeight + cellHeight: elisaTheme.gridDelegateSize + secondaryLabelSize.boundingRect.height * 2 + elisaTheme.layoutVerticalMargin * 2
(secondaryLabelSize.boundingRect.height - secondaryLabelSize.boundingRect.y) *
(delegateDisplaySecondaryText ? 2 : 1)
delegate: GridBrowserDelegate { delegate: GridBrowserDelegate {
width: elisaTheme.gridDelegateWidth width: elisaTheme.gridDelegateSize
height: contentDirectoryView.cellHeight height: contentDirectoryView.cellHeight
focus: true focus: true
......
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