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