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

@@ -8,7 +8,9 @@ import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.neochat
import org.kde.neochat.libneochat as LibNeoChat
/**
* @brief A component for typing and sending chat messages.
@@ -165,7 +167,7 @@ QQC2.Control {
}
leftPadding: rightPadding
rightPadding: (root.width - chatBarSizeHelper.currentWidth) / 2
rightPadding: (root.width - chatBarSizeHelper.availableWidth) / 2
topPadding: 0
bottomPadding: 0
@@ -353,15 +355,14 @@ QQC2.Control {
}
}
}
DelegateSizeHelper {
LibNeoChat.DelegateSizeHelper {
id: chatBarSizeHelper
parentItem: root
startBreakpoint: Kirigami.Units.gridUnit * 46
endBreakpoint: Kirigami.Units.gridUnit * 66
startPercentWidth: 100
endPercentWidth: NeoChatConfig.compactLayout ? 100 : 85
maxWidth: NeoChatConfig.compactLayout ? -1 : Kirigami.Units.gridUnit * 60
parentWidth: root.width
}
Component {