From 3ba9a1eb5d34a63004ef04d96e5e5999ef6e78b0 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 29 Aug 2020 14:46:35 +0200 Subject: [PATCH] auto clear of search field and fixed bug causing some lines not to update --- .../src/gui/gxschannels/GxsChannelPostsModel.cpp | 8 ++++++-- retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.h | 2 ++ .../gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp index be603891d..41129d538 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp @@ -69,7 +69,7 @@ void RsGxsChannelPostsModel::setMode(TreeMode mode) if(mode == TREE_MODE_LIST) setNumColumns(2); - emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,mColumns-1,(void*)NULL)); + triggerViewUpdate(); } void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr event) @@ -116,7 +116,7 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptrpostsTree->setFocus(); - ui->postsTree->dataChanged(QModelIndex(),QModelIndex()); // forces update of the whole tree + mChannelPostsModel->triggerViewUpdate(); // This is already called by setMode(), but the model cannot know how many + // columns is actually has until we call handlePostsTreeSizeChange(), so + // we have to call it again here. } void GxsChannelPostsWidgetWithModel::copyMessageLink() @@ -581,7 +583,7 @@ void GxsChannelPostsWidgetWithModel::handlePostsTreeSizeChange(QSize s,bool forc int n_columns = std::max(1,(int)floor(s.width() / (mChannelPostsDelegate->cellSize(0,font(),ui->postsTree->width())))); std::cerr << "nb columns: " << n_columns << " current count=" << mChannelPostsModel->columnCount() << std::endl; - if(n_columns != mChannelPostsModel->columnCount()) + if(force || (n_columns != mChannelPostsModel->columnCount())) mChannelPostsModel->setNumColumns(n_columns); } @@ -714,6 +716,7 @@ void GxsChannelPostsWidgetWithModel::updateGroupData() { mGroup = group; mChannelPostsModel->updateChannel(groupId()); + ui->filterLineEdit->clear(); insertChannelDetails(mGroup);