Utils: Add a way to trigger the HeaderViewStretcher

Change-Id: I4fd3179015ba325d8e739357d393aff6ce23072f
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2016-02-24 17:58:44 +01:00
parent 29fadd610b
commit b4a2a20da7
2 changed files with 8 additions and 2 deletions

View File

@@ -44,8 +44,13 @@ HeaderViewStretcher::HeaderViewStretcher(QHeaderView *headerView, int columnToSt
: QObject(headerView), m_columnToStretch(columnToStretch) : QObject(headerView), m_columnToStretch(columnToStretch)
{ {
headerView->installEventFilter(this); headerView->installEventFilter(this);
stretch();
}
void HeaderViewStretcher::stretch()
{
QHideEvent fake; QHideEvent fake;
HeaderViewStretcher::eventFilter(headerView, &fake); HeaderViewStretcher::eventFilter(parent(), &fake);
} }
bool HeaderViewStretcher::eventFilter(QObject *obj, QEvent *ev) bool HeaderViewStretcher::eventFilter(QObject *obj, QEvent *ev)

View File

@@ -41,7 +41,8 @@ class QTCREATOR_UTILS_EXPORT HeaderViewStretcher : public QObject
public: public:
explicit HeaderViewStretcher(QHeaderView *headerView, int columnToStretch); explicit HeaderViewStretcher(QHeaderView *headerView, int columnToStretch);
virtual bool eventFilter(QObject *obj, QEvent *ev); void stretch();
bool eventFilter(QObject *obj, QEvent *ev) override;
}; };
} // namespace Utils } // namespace Utils