mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-25 23:06:10 -05:00
Fixed size of the state column after switching it on.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3922 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
74f3b3d5a3
commit
d4393b8d0b
@ -122,6 +122,7 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
|
||||
last_status_send_time = 0 ;
|
||||
groupsHasChanged = false;
|
||||
correctColumnStatusSize = false;
|
||||
|
||||
m_compareRole = new RSTreeWidgetItemCompareRole;
|
||||
m_compareRole->setRole(COLUMN_NAME, ROLE_SORT);
|
||||
@ -235,7 +236,11 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
// load settings
|
||||
processSettings(true);
|
||||
|
||||
ui.peertreeWidget->header()->setStretchLastSection(true);
|
||||
/* Set header sizes for the fixed columns and resize modes, must be set after processSettings */
|
||||
QHeaderView *header = ui.peertreeWidget->header();
|
||||
header->setStretchLastSection(true);
|
||||
ui.peertreeWidget->setColumnWidth(COLUMN_STATE, 20); // small enough
|
||||
header->setResizeMode(COLUMN_STATE, QHeaderView::Stretch);
|
||||
|
||||
// workaround for Qt bug, should be solved in next Qt release 4.7.0
|
||||
// http://bugreports.qt.nokia.com/browse/QTBUG-8270
|
||||
@ -301,6 +306,11 @@ void PeersDialog::processSettings(bool bLoad)
|
||||
}
|
||||
Settings->endArray();
|
||||
|
||||
if (ui.peertreeWidget->isColumnHidden(COLUMN_STATE) && header->sectionSize(COLUMN_STATE) < 100) {
|
||||
// Workaround
|
||||
correctColumnStatusSize = true;
|
||||
}
|
||||
|
||||
setStateColumn();
|
||||
} else {
|
||||
// save settings
|
||||
@ -2035,6 +2045,10 @@ void PeersDialog::setStateColumn()
|
||||
ui.peertreeWidget->setColumnHidden(COLUMN_STATE, false);
|
||||
ui.peertreeWidget->setHeaderHidden(false);
|
||||
ui.action_Hide_State->setEnabled(false);
|
||||
if (correctColumnStatusSize) {
|
||||
correctColumnStatusSize = false;
|
||||
ui.peertreeWidget->header()->resizeSection(COLUMN_STATE, 100);
|
||||
}
|
||||
if (wasStatusColumnHidden) {
|
||||
ui.peertreeWidget->header()->resizeSection(COLUMN_NAME, ui.peertreeWidget->header()->sectionSize(COLUMN_NAME) - ui.peertreeWidget->header()->sectionSize(COLUMN_STATE));
|
||||
}
|
||||
|
@ -212,6 +212,7 @@ private:
|
||||
QColor newsFeedTabColor;
|
||||
QString newsFeedText;
|
||||
bool wasStatusColumnHidden;
|
||||
bool correctColumnStatusSize;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::PeersDialog ui;
|
||||
|
Loading…
x
Reference in New Issue
Block a user