diff options
author | Brad King <brad.king@kitware.com> | 2020-11-06 12:55:54 +0000 |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-11-06 07:57:51 -0500 |
commit | dd8c91a4f39ff93f3314544af418198f27a2b87d (patch) | |
tree | c48d6547478e5d6407bf170333175004b1bee7d8 | |
parent | 0adaed609ff3e86ee7ec4e0f8b7857e983cfc6f5 (diff) | |
parent | 5f782119c8f368c6ef99a8d4e3b531cbef995cb6 (diff) | |
download | cmake-dd8c91a4f39ff93f3314544af418198f27a2b87d.tar.gz |
Merge topic 'cmake-gui-file-dialog-crash' into release-3.19
5f782119c8 cmake-gui: Restore workaround for crash in file dialog
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5472
-rw-r--r-- | Source/QtDialog/QCMakeCacheView.cxx | 13 | ||||
-rw-r--r-- | Source/QtDialog/QCMakeCacheView.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 4f4b218a1b..22f5be19f7 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -642,6 +642,19 @@ bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, return success; } +bool QCMakeCacheModelDelegate::eventFilter(QObject* object, QEvent* evt) +{ + // FIXME: This filter avoids a crash when opening a file dialog + // with the '...' button on a cache entry line in the GUI. + // Previously this filter was commented as a workaround for Qt issue 205903, + // but that was fixed in Qt 4.5.0 and the crash still occurs as of Qt 5.14 + // without this filter. This needs further investigation. + if (evt->type() == QEvent::FocusOut && this->FileDialogFlag) { + return false; + } + return QItemDelegate::eventFilter(object, evt); +} + void QCMakeCacheModelDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index 11c6d3e5b7..c5e6dd4438 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -143,6 +143,7 @@ public: bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index); + bool eventFilter(QObject* object, QEvent* event); void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const; QSize sizeHint(const QStyleOptionViewItem& option, |