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:
commit
0d2785eb49
|
@ -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.
|
||||||
|
|
|
@ -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());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue