Commit 306a945b authored by dt's avatar dt
Browse files

Navigation Tree View: Fix width of column

We want to have the width both to be at least the contents size
but also stretch to width of the viewport.

Reviewed-By: con
parent 36ecc99b
......@@ -61,8 +61,8 @@ NavigationTreeView::NavigationTreeView(QWidget *parent)
setAttribute(Qt::WA_MacShowFocusRect, false);
setHeaderHidden(true);
// show horizontal scrollbar
// We let the column adjust to contents, but note
// the setting of a minimum size in resizeEvent()
header()->setResizeMode(QHeaderView::ResizeToContents);
header()->setStretchLastSection(false);
}
......@@ -82,6 +82,12 @@ void NavigationTreeView::focusOutEvent(QFocusEvent *event)
QTreeView::focusOutEvent(event);
}
void NavigationTreeView::resizeEvent(QResizeEvent *event)
{
header()->setMinimumSectionSize(viewport()->width());
QTreeView::resizeEvent(event);
}
#ifdef Q_WS_MAC
void NavigationTreeView::keyPressEvent(QKeyEvent *event)
{
......
......@@ -49,6 +49,7 @@ public:
protected:
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
void resizeEvent(QResizeEvent *event);
#ifdef Q_WS_MAC
void keyPressEvent(QKeyEvent *event);
......
......@@ -83,7 +83,6 @@ NavigationWidget::NavigationWidget(QWidget *parent) :
// tree model
d_ptr->treeModel = new TreeItemModel(this);
d_ptr->ui->treeView->header()->setStretchLastSection(true);
d_ptr->ui->treeView->setModel(d_ptr->treeModel);
// connect signal/slots
......
......@@ -116,7 +116,6 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
this, SLOT(filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &)));
m_view = new ProjectTreeView;
m_view->header()->setStretchLastSection(true);
m_view->setModel(m_model);
setFocusProxy(m_view);
initView();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment