fixed selection of current item from link in channels

This commit is contained in:
csoler 2020-06-23 00:44:09 +02:00
parent 1c2e094f20
commit 97ad766863
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 4 additions and 8 deletions

View File

@ -719,7 +719,7 @@ QModelIndex RsGxsChannelPostsModel::getIndexOfMessage(const RsGxsMessageId& mid)
quintptr ref ;
convertTabEntryToRefPointer(i,ref); // we dont use i+1 here because i is not a row, but an index in the mPosts tab
return createIndex(i%mColumns, i/mColumns,ref);
return createIndex(i/mColumns,i%mColumns, ref);
}
if(mPosts[mFilteredPosts[i]].mMeta.mMsgId == postId)
@ -727,7 +727,7 @@ QModelIndex RsGxsChannelPostsModel::getIndexOfMessage(const RsGxsMessageId& mid)
quintptr ref ;
convertTabEntryToRefPointer(i,ref); // we dont use i+1 here because i is not a row, but an index in the mPosts tab
return createIndex(i%mColumns, i/mColumns,ref);
return createIndex(i/mColumns,i%mColumns, ref);
}
}

View File

@ -425,8 +425,6 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
ui->postTime_LB->hide();
mChannelPostFilesModel->clear();
std::cerr << "showPostDetails: no valid post. Clearing mSelectedPost." << std::endl;
mSelectedPost.clear();
return;
}
@ -540,9 +538,8 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
<< mSelectedPost.toStdString() << std::endl;
ui->postsTree->selectionModel()->setCurrentIndex(index,QItemSelectionModel::ClearAndSelect);
ui->postsTree->scrollTo(ui->postsTree->currentIndex());//May change if model reloaded
ui->postsTree->scrollTo(index);//May change if model reloaded
ui->postsTree->setFocus();
ui->postsTree->update();
}
else
std::cerr << "No pre-selected channel post." << std::endl;
@ -1049,9 +1046,8 @@ bool GxsChannelPostsWidgetWithModel::navigate(const RsGxsMessageId& msgId)
}
ui->postsTree->selectionModel()->setCurrentIndex(index,QItemSelectionModel::ClearAndSelect);
ui->postsTree->scrollTo(ui->postsTree->currentIndex());//May change if model reloaded
ui->postsTree->scrollTo(index);//May change if model reloaded
ui->postsTree->setFocus();
ui->postsTree->update();
return true;
}