Fix: Seletion is cleared when paletted changed.

修复收到palettechanged信号时列表选中状态消失的问题.
This commit is contained in:
zhangjiaping 2021-05-12 15:40:57 +08:00
parent 550681b38f
commit b47720396e
3 changed files with 12 additions and 0 deletions

View File

@ -128,7 +128,13 @@ void SearchListView::clear() {
*/
void SearchListView::refresh()
{
QModelIndex index = this->currentIndex();
m_model->refresh();
if(index.row() >= 0 && index.row() < m_model->length() && m_isSelected) {
this->blockSignals(true);
this->setCurrentIndex(index);
this->blockSignals(false);
}
rowheight = this->rowHeight(this->model()->index(0, 0, QModelIndex())) + 1;
this->setFixedHeight(m_item->getCurrentSize() * rowheight + 4);
}

View File

@ -186,3 +186,8 @@ void SearchItemModel::refresh()
this->beginResetModel();
this->endResetModel();
}
int SearchItemModel::length()
{
return m_item->m_pathlist.length();
}

View File

@ -60,6 +60,7 @@ public:
void clear();
void setBestAppIcon(const QString &, const bool &);
void refresh();
int length();
private :
SearchItem * m_item = nullptr;