From b4a2a20da703ee9afeba27f434d4f25f56c06ed6 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 24 Feb 2016 17:58:44 +0100 Subject: [PATCH] Utils: Add a way to trigger the HeaderViewStretcher Change-Id: I4fd3179015ba325d8e739357d393aff6ce23072f Reviewed-by: Eike Ziller --- src/libs/utils/headerviewstretcher.cpp | 7 ++++++- src/libs/utils/headerviewstretcher.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/headerviewstretcher.cpp b/src/libs/utils/headerviewstretcher.cpp index 0af5586ac8a..0728dedfa06 100644 --- a/src/libs/utils/headerviewstretcher.cpp +++ b/src/libs/utils/headerviewstretcher.cpp @@ -44,8 +44,13 @@ HeaderViewStretcher::HeaderViewStretcher(QHeaderView *headerView, int columnToSt : QObject(headerView), m_columnToStretch(columnToStretch) { headerView->installEventFilter(this); + stretch(); +} + +void HeaderViewStretcher::stretch() +{ QHideEvent fake; - HeaderViewStretcher::eventFilter(headerView, &fake); + HeaderViewStretcher::eventFilter(parent(), &fake); } bool HeaderViewStretcher::eventFilter(QObject *obj, QEvent *ev) diff --git a/src/libs/utils/headerviewstretcher.h b/src/libs/utils/headerviewstretcher.h index 85739daf445..2e9190ddeb7 100644 --- a/src/libs/utils/headerviewstretcher.h +++ b/src/libs/utils/headerviewstretcher.h @@ -41,7 +41,8 @@ class QTCREATOR_UTILS_EXPORT HeaderViewStretcher : public QObject public: explicit HeaderViewStretcher(QHeaderView *headerView, int columnToStretch); - virtual bool eventFilter(QObject *obj, QEvent *ev); + void stretch(); + bool eventFilter(QObject *obj, QEvent *ev) override; }; } // namespace Utils