corrected bug about wrong layout of friend list (patch from asamK)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4652 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-10-24 16:10:24 +00:00
parent 659814f156
commit 78955270e2
2 changed files with 20 additions and 17 deletions

View File

@ -1425,22 +1425,28 @@ void FriendList::setHideStatusColumn(bool hidden)
void FriendList::setHideAvatarColumn(bool hidden) void FriendList::setHideAvatarColumn(bool hidden)
{ {
if (mHideAvatarColumn != hidden) { if (mHideAvatarColumn == hidden)
QHeaderView *header = ui->peerTreeWidget->header(); return;
ui->peerTreeWidget->setColumnHidden(COLUMN_AVATAR, hidden);
if (mHideAvatarColumn) { // if column was hidden
if (header->sectionSize(COLUMN_NAME) > COLUMN_AVATAR_WIDTH) {
// resize name column to make room for avatar column, but only if it doesn't result in negative width
header->resizeSection(COLUMN_NAME, header->sectionSize(COLUMN_NAME) - COLUMN_AVATAR_WIDTH);
}
} else {
header->resizeSection(COLUMN_NAME, header->sectionSize(COLUMN_NAME) + COLUMN_AVATAR_WIDTH);
}
mHideAvatarColumn = hidden; bool columnWasHidden = mHideAvatarColumn;
updateHeaderSizes(); mHideAvatarColumn = hidden;
insertPeers(); ui->peerTreeWidget->setColumnHidden(COLUMN_AVATAR, hidden);
if (RsAutoUpdatePage::eventsLocked()) // don't change header sizes
return;
QHeaderView *header = ui->peerTreeWidget->header();
if (columnWasHidden) {
if (header->sectionSize(COLUMN_NAME) > COLUMN_AVATAR_WIDTH) {
// resize name column to make room for avatar column, but only if it doesn't result in negative width
header->resizeSection(COLUMN_NAME, header->sectionSize(COLUMN_NAME) - COLUMN_AVATAR_WIDTH);
}
} else {
header->resizeSection(COLUMN_NAME, header->sectionSize(COLUMN_NAME) + COLUMN_AVATAR_WIDTH);
} }
updateHeaderSizes();
insertPeers();
} }
void FriendList::setHideState(bool hidden) void FriendList::setHideState(bool hidden)

View File

@ -66,9 +66,6 @@
<attribute name="headerDefaultSectionSize"> <attribute name="headerDefaultSectionSize">
<number>200</number> <number>200</number>
</attribute> </attribute>
<attribute name="headerDefaultSectionSize">
<number>200</number>
</attribute>
<column> <column>
<property name="text"> <property name="text">
<string>Friends</string> <string>Friends</string>