Refactor based on better implementation

This commit is contained in:
James Graham
2024-05-28 19:14:30 +01:00
parent 6a1ff37011
commit 90829e4959

View File

@@ -10,7 +10,6 @@ import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.delegates as Delegates import org.kde.kirigamiaddons.delegates as Delegates
import org.kde.kirigamiaddons.labs.components as Components import org.kde.kirigamiaddons.labs.components as Components
import org.kde.kitemmodels import org.kde.kitemmodels
import org.kde.desktop.private as Private
import org.kde.neochat import org.kde.neochat
@@ -46,6 +45,14 @@ QQC2.ItemDelegate {
Keys.onEnterPressed: clicked() Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
leftInset: horizontalPadding / 2
rightInset: horizontalPadding / 2
// We want total spacing between consecutive list items to be
// verticalPadding. So use half that as top/bottom margin, separately
// ceiling/flooring them so that the total spacing is preserved.
topInset: Math.ceil(verticalPadding / 2)
bottomInset: Math.ceil(verticalPadding / 2)
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: (eventPoint, button) => root.createRoomListContextMenu() onTapped: (eventPoint, button) => root.createRoomListContextMenu()
@@ -146,11 +153,6 @@ QQC2.ItemDelegate {
} }
} }
background: Private.DefaultListItemBackground {
control: root
styling: Private.DefaultListItemBackground.Styling.List
}
function createRoomListContextMenu() { function createRoomListContextMenu() {
const component = Qt.createComponent('org.kde.neochat', 'ContextMenu'); const component = Qt.createComponent('org.kde.neochat', 'ContextMenu');
if (component.status === Component.Error) { if (component.status === Component.Error) {