mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
save/restore hidden columns when switching which column is visible in FriendList
This commit is contained in:
parent
da21a40eda
commit
44444207f7
@ -158,7 +158,7 @@ void RsFriendListModel::postMods()
|
|||||||
{
|
{
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,columnCount()-1,(void*)NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
int RsFriendListModel::rowCount(const QModelIndex& parent) const
|
int RsFriendListModel::rowCount(const QModelIndex& parent) const
|
||||||
@ -1236,7 +1236,7 @@ void RsFriendListModel::collapseItem(const QModelIndex& index)
|
|||||||
mExpandedProfiles.erase(s);
|
mExpandedProfiles.erase(s);
|
||||||
|
|
||||||
// apparently we cannot be subtle here.
|
// apparently we cannot be subtle here.
|
||||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mTopLevel.size()-1,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mTopLevel.size()-1,columnCount()-1,(void*)NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsFriendListModel::expandItem(const QModelIndex& index)
|
void RsFriendListModel::expandItem(const QModelIndex& index)
|
||||||
@ -1261,7 +1261,7 @@ void RsFriendListModel::expandItem(const QModelIndex& index)
|
|||||||
mExpandedProfiles.insert(s);
|
mExpandedProfiles.insert(s);
|
||||||
|
|
||||||
// apparently we cannot be subtle here.
|
// apparently we cannot be subtle here.
|
||||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mTopLevel.size()-1,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mTopLevel.size()-1,columnCount()-1,(void*)NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsFriendListModel::isProfileExpanded(const EntryIndex& e) const
|
bool RsFriendListModel::isProfileExpanded(const EntryIndex& e) const
|
||||||
|
@ -1096,7 +1096,13 @@ void NewFriendList::applyWhileKeepingTree(std::function<void()> predicate)
|
|||||||
saveExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
saveExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
||||||
|
|
||||||
// This is a hack to avoid crashes on windows while calling endInsertRows(). I'm not sure wether these crashes are
|
// This is a hack to avoid crashes on windows while calling endInsertRows(). I'm not sure wether these crashes are
|
||||||
// due to a Qt bug, or a misuse of the proxy model on my side. Anyway, this soves them for good.
|
// due to a Qt bug, or a misuse of the proxy model on my side. Anyway, this solves them for good.
|
||||||
|
|
||||||
|
// save hidden columns
|
||||||
|
std::list<int> hidden_columns;
|
||||||
|
for(int i=0;i<RsFriendListModel::COLUMN_THREAD_NB_COLUMNS;++i)
|
||||||
|
if(ui->peerTreeWidget->isColumnHidden(i))
|
||||||
|
hidden_columns.push_back(i);
|
||||||
|
|
||||||
mProxyModel->setSourceModel(nullptr);
|
mProxyModel->setSourceModel(nullptr);
|
||||||
|
|
||||||
@ -1104,6 +1110,10 @@ void NewFriendList::applyWhileKeepingTree(std::function<void()> predicate)
|
|||||||
|
|
||||||
mProxyModel->setSourceModel(mModel);
|
mProxyModel->setSourceModel(mModel);
|
||||||
restoreExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
restoreExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
||||||
|
|
||||||
|
// restore hidden columns
|
||||||
|
for(auto c: hidden_columns)
|
||||||
|
ui->peerTreeWidget->setColumnHidden(c,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewFriendList::checkInternalData(bool force)
|
void NewFriendList::checkInternalData(bool force)
|
||||||
|
Loading…
Reference in New Issue
Block a user