diff --git a/src/libs/utils/headerviewstretcher.cpp b/src/libs/utils/headerviewstretcher.cpp index 2c3ece302a4..3c21a2d1ba9 100644 --- a/src/libs/utils/headerviewstretcher.cpp +++ b/src/libs/utils/headerviewstretcher.cpp @@ -53,6 +53,13 @@ void HeaderViewStretcher::stretch() HeaderViewStretcher::eventFilter(parent(), &fake); } +void HeaderViewStretcher::softStretch() +{ + const auto hv = qobject_cast(parent()); + for (int i = 0; i < hv->count(); ++i) + hv->resizeSections(QHeaderView::ResizeToContents); +} + bool HeaderViewStretcher::eventFilter(QObject *obj, QEvent *ev) { if (obj == parent()) { diff --git a/src/libs/utils/headerviewstretcher.h b/src/libs/utils/headerviewstretcher.h index e360ff58b1c..ab874e734a4 100644 --- a/src/libs/utils/headerviewstretcher.h +++ b/src/libs/utils/headerviewstretcher.h @@ -41,6 +41,7 @@ public: explicit HeaderViewStretcher(QHeaderView *headerView, int columnToStretch); void stretch(); + void softStretch(); bool eventFilter(QObject *obj, QEvent *ev) override; }; diff --git a/src/plugins/projectexplorer/environmentwidget.cpp b/src/plugins/projectexplorer/environmentwidget.cpp index 23f3c5697a6..72acba403f5 100644 --- a/src/plugins/projectexplorer/environmentwidget.cpp +++ b/src/plugins/projectexplorer/environmentwidget.cpp @@ -233,7 +233,11 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, Type type, QWidget *additi d->m_environmentView->setMinimumHeight(400); d->m_environmentView->setRootIsDecorated(false); d->m_environmentView->setUniformRowHeights(true); - new Utils::HeaderViewStretcher(d->m_environmentView->header(), 1); + const auto stretcher = new HeaderViewStretcher(d->m_environmentView->header(), 1); + connect(d->m_model, &QAbstractItemModel::dataChanged, + stretcher, &HeaderViewStretcher::softStretch); + connect(d->m_model, &EnvironmentModel::userChangesChanged, + stretcher, &HeaderViewStretcher::softStretch); d->m_environmentView->setSelectionMode(QAbstractItemView::SingleSelection); d->m_environmentView->setSelectionBehavior(QAbstractItemView::SelectItems); d->m_environmentView->setFrameShape(QFrame::NoFrame);