Merge pull request #193 from iaom/0313-dev

Make search result list scrolling with current selection item changing when key_up and key_down pressed.
This commit is contained in:
张佳萍 2021-03-25 17:18:00 +08:00 committed by GitHub
commit 0d2785eb49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 1 deletions

7
debian/changelog vendored
View File

@ -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 <zhangpengfei@kylinos.cn> Thu, 25 Mar 2021 11:00:09 +0800
ukui-search (0.2.0+0322) v101; urgency=medium ukui-search (0.2.0+0322) v101; urgency=medium
* Fit muti-screens mode. * Fit muti-screens mode.

View File

@ -300,6 +300,9 @@ void ContentWidget::setupConnect(SearchListView * listview) {
listview->blockSignals(false); listview->blockSignals(false);
} }
}); });
connect(listview,&SearchListView::currentSelectPos,[=](QPoint pos){
m_resultListArea->ensureVisible(pos.x(),pos.y());
});
} }
/** /**

View File

@ -45,9 +45,15 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const
this->setItemDelegate(m_styleDelegate); this->setItemDelegate(m_styleDelegate);
m_type = type; 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())); Q_EMIT this->currentRowChanged(getCurrentType(), m_item->m_pathlist.at(this->currentIndex().row()));
m_isSelected = true; 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) { connect(this, &SearchListView::doubleClicked, this, [ = ](const QModelIndex& index) {

View File

@ -71,6 +71,7 @@ private:
Q_SIGNALS: Q_SIGNALS:
void currentRowChanged(const int&, const QString&); void currentRowChanged(const int&, const QString&);
void currentSelectPos(QPoint pos);
public Q_SLOTS: public Q_SLOTS:
void clearSelection(); void clearSelection();