mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -05:00
gxsforums: restore post's selection after clearing search filter
This commit is contained in:
parent
b265cdf284
commit
2c03deaa33
@ -1801,10 +1801,26 @@ void GxsForumThreadWidget::filterItems(const QString& text)
|
||||
// We do this in order to trigger a new filtering action in the proxy model.
|
||||
mThreadProxyModel->setFilterRegExp(QRegExp(QString(RsGxsForumModel::FilterString))) ;
|
||||
|
||||
if(!lst.empty())
|
||||
if(!lst.empty())
|
||||
ui->threadTreeWidget->expandAll();
|
||||
else
|
||||
else {
|
||||
// currentIndex() not on the clicked message, so not this way
|
||||
// if (!mThreadId.isNull()) {
|
||||
// an_index = mThreadProxyModel->mapToSource(ui->threadTreeWidget->currentIndex());
|
||||
// }
|
||||
ui->threadTreeWidget->collapseAll();
|
||||
if (!mThreadId.isNull()) {
|
||||
// ...but this one
|
||||
QModelIndex an_index = mThreadModel->getIndexOfMessage(mThreadId);
|
||||
if (an_index.isValid()) {
|
||||
QModelIndex the_index = mThreadProxyModel->mapFromSource(an_index);
|
||||
ui->threadTreeWidget->setCurrentIndex(the_index);
|
||||
ui->threadTreeWidget->scrollTo(the_index);
|
||||
// don't change focus
|
||||
// ui->threadTreeWidget->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(count > 0)
|
||||
ui->filterLineEdit->setToolTip(tr("No result.")) ;
|
||||
|
Loading…
Reference in New Issue
Block a user