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,10 +1425,18 @@ void FriendList::setHideStatusColumn(bool hidden)
void FriendList::setHideAvatarColumn(bool hidden)
{
if (mHideAvatarColumn != hidden) {
QHeaderView *header = ui->peerTreeWidget->header();
if (mHideAvatarColumn == hidden)
return;
bool columnWasHidden = mHideAvatarColumn;
mHideAvatarColumn = hidden;
ui->peerTreeWidget->setColumnHidden(COLUMN_AVATAR, hidden);
if (mHideAvatarColumn) { // if column was 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);
@ -1437,11 +1445,9 @@ void FriendList::setHideAvatarColumn(bool hidden)
header->resizeSection(COLUMN_NAME, header->sectionSize(COLUMN_NAME) + COLUMN_AVATAR_WIDTH);
}
mHideAvatarColumn = hidden;
updateHeaderSizes();
insertPeers();
}
}
void FriendList::setHideState(bool hidden)
{

View File

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