Git commit 0e1a0409c82f460115a3f99ed63c4f5cdf804492 by Jan Kundr?t. Committed on 27/05/2013 at 00:42. Pushed by jkt into branch 'master'.
GUI: resize the header columns *initially*, but respect the user preferences later on M +6 -2 src/Gui/MsgListView.cpp M +2 -1 src/Gui/MsgListView.h M +1 -3 src/Gui/Window.cpp http://commits.kde.org/trojita/0e1a0409c82f460115a3f99ed63c4f5cdf804492 diff --git a/src/Gui/MsgListView.cpp b/src/Gui/MsgListView.cpp index dc01ecd..6d97054 100644 --- a/src/Gui/MsgListView.cpp +++ b/src/Gui/MsgListView.cpp @@ -37,7 +37,7 @@ namespace Gui { -MsgListView::MsgListView(QWidget *parent): QTreeView(parent), m_autoActivateAfterKeyNavigation(true) +MsgListView::MsgListView(QWidget *parent): QTreeView(parent), m_autoActivateAfterKeyNavigation(true), m_autoResizeSections(true) { connect(header(), SIGNAL(geometriesChanged()), this, SLOT(slotFixSize())); connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(slotExpandWholeSubtree(QModelIndex))); @@ -237,6 +237,9 @@ void MsgListView::slotFixSize() #else header()->setResizeMode(i, resizeMode); #endif + if (m_autoResizeSections) { + setColumnWidth(i, sizeHintForColumn(i)); + } } } @@ -314,8 +317,9 @@ void MsgListView::slotHeaderSectionVisibilityToggled(int section) } } -void MsgListView::updateActions() +void MsgListView::updateActionsAfterRestoredState() { + m_autoResizeSections = false; QList<QAction *> actions = header()->actions(); for (int i = 0; i < actions.size(); ++i) { actions[i]->setChecked(!header()->isSectionHidden(i)); diff --git a/src/Gui/MsgListView.h b/src/Gui/MsgListView.h index 43232ca..465bab8 100644 --- a/src/Gui/MsgListView.h +++ b/src/Gui/MsgListView.h @@ -49,7 +49,7 @@ public: virtual ~MsgListView() {} void setModel(QAbstractItemModel *model); void setAutoActivateAfterKeyNavigation(bool enabled); - void updateActions(); + void updateActionsAfterRestoredState(); protected: void keyPressEvent(QKeyEvent *ke); void keyReleaseEvent(QKeyEvent *ke); @@ -73,6 +73,7 @@ private: QSignalMapper *headerFieldsMapper; QTimer *m_naviActivationTimer; bool m_autoActivateAfterKeyNavigation; + bool m_autoResizeSections; }; } diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp index dff99b8..7bcdef8 100644 --- a/src/Gui/Window.cpp +++ b/src/Gui/Window.cpp @@ -2159,7 +2159,7 @@ void MainWindow::applySizesAndState() stream >> item; msgListWidget->tree->header()->restoreState(item); // got to manually update the state of the actions which control the visibility state - msgListWidget->tree->updateActions(); + msgListWidget->tree->updateActionsAfterRestoredState(); } } @@ -2169,5 +2169,3 @@ void MainWindow::resizeEvent(QResizeEvent *) } } - -
