From 93958cc2280d76708691335ff42acf7299008d92 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Thu, 25 Mar 2021 15:45:09 +0800 Subject: [PATCH] Update changelog; Make search result list scrolling with current selection item changing when key_up and key_down pressed. --- debian/changelog | 7 +++++++ src/content-widget.cpp | 3 +++ src/control/search-list-view.cpp | 8 +++++++- src/control/search-list-view.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e518d80..ca8b145 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ukui-search (0.2.0+0325) v101; urgency=medium + + * Changed name displayed in ukui-menu from 'ukui-search' to 'Search'. + - 更改了英文模式下开始菜单中显示的名字。 + + -- zhangpengfei Thu, 25 Mar 2021 11:00:09 +0800 + ukui-search (0.2.0+0322) v101; urgency=medium * Fit muti-screens mode. diff --git a/src/content-widget.cpp b/src/content-widget.cpp index ecb056d..5e39292 100644 --- a/src/content-widget.cpp +++ b/src/content-widget.cpp @@ -300,6 +300,9 @@ void ContentWidget::setupConnect(SearchListView * listview) { listview->blockSignals(false); } }); + connect(listview,&SearchListView::currentSelectPos,[=](QPoint pos){ + m_resultListArea->ensureVisible(pos.x(),pos.y()); + }); } /** diff --git a/src/control/search-list-view.cpp b/src/control/search-list-view.cpp index 45752a6..c66c2ca 100644 --- a/src/control/search-list-view.cpp +++ b/src/control/search-list-view.cpp @@ -45,9 +45,15 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const this->setItemDelegate(m_styleDelegate); m_type = type; - connect(this->selectionModel(), &QItemSelectionModel::selectionChanged, this, [ = ]() { + connect(this->selectionModel(), &QItemSelectionModel::selectionChanged, this, [ = ](const QItemSelection &selected, const QItemSelection &deselected) { Q_EMIT this->currentRowChanged(getCurrentType(), m_item->m_pathlist.at(this->currentIndex().row())); m_isSelected = true; + if(!selected.isEmpty()) + { + QRegion region = visualRegionForSelection(selected); + QRect rect = region.boundingRect(); + Q_EMIT this->currentSelectPos(mapToParent(rect.topLeft())); + } }); connect(this, &SearchListView::doubleClicked, this, [ = ](const QModelIndex& index) { diff --git a/src/control/search-list-view.h b/src/control/search-list-view.h index 51b223f..b343425 100644 --- a/src/control/search-list-view.h +++ b/src/control/search-list-view.h @@ -71,6 +71,7 @@ private: Q_SIGNALS: void currentRowChanged(const int&, const QString&); + void currentSelectPos(QPoint pos); public Q_SLOTS: void clearSelection();