forked from openkylin/ukui-search
fix(frontend): Two list items can be selected simultaneously.
Description: 修复可以同时选中两个列表项的bug Log: 修复可以同时选中两个列表项的bug Bug: http://172.17.66.192/biz/bug-view-40056.html
This commit is contained in:
parent
067bc79234
commit
25c18aa4f0
|
@ -47,6 +47,7 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const
|
|||
m_type = type;
|
||||
connect(this->selectionModel(), &QItemSelectionModel::selectionChanged, this, [ = ]() {
|
||||
Q_EMIT this->currentRowChanged(getCurrentType(), m_item->m_pathlist.at(this->currentIndex().row()));
|
||||
m_isSelected = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -78,7 +79,7 @@ void SearchListView::setList(QStringList list)
|
|||
{
|
||||
QModelIndex index = this->currentIndex();
|
||||
m_model->setList(list);
|
||||
if (index.row() >= 0 && index.row() < list.length()) {
|
||||
if (index.row() >= 0 && index.row() < list.length() && m_isSelected) {
|
||||
this->blockSignals(true);
|
||||
this->setCurrentIndex(index);
|
||||
this->blockSignals(false);
|
||||
|
@ -184,4 +185,5 @@ int SearchListView::getResType(const QString& path) {
|
|||
*/
|
||||
void SearchListView::clearSelection() {
|
||||
this->selectionModel()->clearSelection();
|
||||
m_isSelected = false;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
private:
|
||||
SearchItemModel * m_model = nullptr;
|
||||
SearchItem * m_item = nullptr;
|
||||
bool m_isSelected = false;
|
||||
|
||||
HighlightItemDelegate * m_styleDelegate = nullptr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue