Skip to content

Commit

Permalink
fix: search result view show vertical scrollbar
Browse files Browse the repository at this point in the history
search result view show vertical scrollbar

Log: search result view show vertical scrollbar
Issue: linuxdeepin/developer-center#7833
Influence: search result view show vertical scrollbar
  • Loading branch information
yixinshark committed May 8, 2024
1 parent 197fc69 commit 37df265
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
5 changes: 4 additions & 1 deletion qml/FullscreenFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,10 @@ Control {
model: delegateSearchResultModel
padding: 10
interactive: true
vScrollBar: ScrollBar { }
vScrollBar: ScrollBar {
visible: parent.model.count > 4 * 8
active: parent.model.count > 4 * 8
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions qml/windowed/GridViewContainer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ FocusScope {
readonly property alias currentItem: gridView.currentItem
readonly property alias gridViewWidth: gridView.width
property alias highlight: gridView.highlight
property ScrollBar vScrollBar

function positionViewAtBeginning() {
gridView.positionViewAtBeginning()
Expand All @@ -57,6 +58,7 @@ FocusScope {
id: gridView
width: root.cellWidth * columns + paddingColumns * Math.max(0, columns - 1) + paddingColumns
height: root.cellHeight * rows + paddingRows * Math.max(0, rows - 1) + paddingRows
ScrollBar.vertical: root.vScrollBar

anchors.centerIn: parent

Expand Down
35 changes: 23 additions & 12 deletions qml/windowed/SearchResultView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,42 @@ Control {
font: LauncherController.adjustFontWeight(DTK.fontManager.t6, Font.Bold)
}

GridViewContainer {
id: searchResultViewContainer

KeyNavigation.tab: nextKeyTabTarget
Layout.alignment: Qt.AlignRight
Layout.topMargin: 10
Layout.preferredHeight: searchResultViewContainer.height
Layout.preferredWidth: searchResultViewContainer.width
interactive: true

DelegateModel {
id: delegateSearchResultModel
model: SearchFilterProxyModel

delegate: IconItemDelegate {
iconSource: iconName
width: searchResultViewContainer.cellWidth
height: searchResultViewContainer.cellHeight
iconSource: iconName
onItemClicked: {
launchApp(desktopId)
}
onMenuTriggered: {
showContextMenu(this, model, false, false, true)
}
}
}

GridViewContainer {
id: searchResultViewContainer

KeyNavigation.tab: nextKeyTabTarget
Layout.alignment: Qt.AlignRight
Layout.topMargin: 10
Layout.rightMargin: 10
Layout.preferredHeight: searchResultViewContainer.height
Layout.preferredWidth: searchResultViewContainer.width - 10
interactive: true

model: delegateSearchResultModel

activeFocusOnTab: gridViewFocus

vScrollBar: ScrollBar {
id: vScrollBar
visible: parent.model.count > 4 * 4
active: parent.model.count > 4 * 4
}
}

Item {
Expand Down

0 comments on commit 37df265

Please sign in to comment.