delegatesizehelper updates

Make `DelegateSizeHelper` take a `QQuickItem` rather than a width value and move `TimelineDelegate` to use it rather than duplicting the code.

This requires the creation of `LibNeoChat` so that both the main and timeline modules can get access to the class.

Note: ideally more stuff will go into `LibNeoChat` but it turns out our dependencies are kinda spaghetti like and so will take some untangling.
This commit is contained in:
James Graham
2025-04-03 15:24:31 +00:00
parent f026e4e5ed
commit 054f87cae2
12 changed files with 214 additions and 172 deletions

View File

@@ -10,6 +10,7 @@ import org.kde.kirigamiaddons.delegates as Delegates
import org.kde.kirigamiaddons.labs.components as Components
import org.kde.neochat
import org.kde.neochat.libneochat as LibNeoChat
Item {
id: root
@@ -44,7 +45,7 @@ Item {
anchors.horizontalCenter: root.horizontalCenter
anchors.verticalCenter: root.verticalCenter
width: sizeHelper.currentWidth
width: sizeHelper.availableWidth
highlighted: dropArea.containsDrag
@@ -201,15 +202,14 @@ Item {
}
}
DelegateSizeHelper {
LibNeoChat.DelegateSizeHelper {
id: sizeHelper
parentItem: root
startBreakpoint: Kirigami.Units.gridUnit * 46
endBreakpoint: Kirigami.Units.gridUnit * 66
startPercentWidth: 100
endPercentWidth: 85
maxWidth: Kirigami.Units.gridUnit * 60
parentWidth: root.treeView ? root.treeView.width : 0
}
Component {

View File

@@ -8,6 +8,7 @@ import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.neochat
import org.kde.neochat.libneochat as LibNeoChat
import org.kde.neochat.settings
ColumnLayout {
@@ -93,15 +94,14 @@ ColumnLayout {
onTextChanged: spaceChildSortFilterModel.filterText = text
}
}
DelegateSizeHelper {
LibNeoChat.DelegateSizeHelper {
id: sizeHelper
parentItem: root
startBreakpoint: Kirigami.Units.gridUnit * 46
endBreakpoint: Kirigami.Units.gridUnit * 66
startPercentWidth: 100
endPercentWidth: 85
maxWidth: Kirigami.Units.gridUnit * 60
parentWidth: root.width
}
}
Kirigami.Separator {