pragma ComponentBehavior: Bound import QtQuick 2.15 // Removing version break onCurrentItemChanged import QtQuick.Layouts import QtQuick.Controls as QQC2 import org.kde.kirigamiaddons.delegates as Delegates import org.kde.kitemmodels 1 as KItemModels import org.kde.kirigami as Kirigami import org.deprecated.kodereviewer Kirigami.ScrollablePage { id: root required property NetworkManager connection required property Project project signal pullRequestSelected(int pullRequest) readonly property int currentWidth: _private.currentWidth + 1 onCurrentWidthChanged: pageStack.defaultColumnWidth = root.currentWidth Component.onCompleted: { pageStack.defaultColumnWidth = root.currentWidth connection.getPullRequests() } Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false PullRequestModel { id: pullRequestModel project: root.project } KItemModels.KSortFilterProxyModel { id: pullRequestFilterModel sourceModel: pullRequestModel filterRoleName: "title" } title: "Pull Requests" actions: [ Kirigami.Action { id: refreshAction icon.name: "view-refresh" shortcut: Shortcut { sequence: "F5" onActivated: { refreshAction.trigger() } } onTriggered: connection.getPullRequests() }, Kirigami.Action { id: searchAction icon.name: "search" shortcut: Shortcut { sequence: "Ctrl+F" onActivated: { print("Shortcut triggered") searchAction.trigger() } } onTriggered: print("search triggered") } ] ListView { id: view model: pullRequestModel clip: true delegate: Delegates.RoundedItemDelegate { required property int number required property string title required property bool draft required property int index highlighted: ListView.isCurrentItem text: `${number} - ${title}` icon { name: "vcs-merge-request" color: draft ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.positiveTextColor } onClicked: { view.currentIndex = index root.pullRequestSelected(number) } } } MouseArea { anchors.top: parent.top anchors.bottom: parent.bottom parent: applicationWindow().overlay.parent x: root.currentWidth - width / 2 width: Kirigami.Units.smallSpacing * 2 z: root.z + 1 enabled: true visible: enabled cursorShape: Qt.SplitHCursor property int _lastX onPressed: mouse => { _lastX = mouse.x; } onPositionChanged: mouse => { if (_lastX == -1) { return; } if (mouse.x > _lastX) { // _private.currentWidth = _private.currentWidth + (_lastX + mouse.x); _private.currentWidth = Math.min(_private.maxWidth, _private.currentWidth + (mouse.x - _lastX)) } else if (mouse.x < _lastX) { const tmpWidth = _private.currentWidth - (_lastX - mouse.x); if (tmpWidth > _private.minWidth) _private.currentWidth = tmpWidth; } } } /* * Hold the modifiable currentWidth in a private object so that only internal * members can modify it. */ QtObject { id: _private property int currentWidth: defaultWidth readonly property int defaultWidth: Kirigami.Units.gridUnit * 17 readonly property int minWidth: Kirigami.Units.gridUnit * 2 readonly property int maxWidth: Kirigami.Units.gridUnit * 25 } }