Hi, everyone!

I'm getting a SegFault while implement an eventFilter in a QDialog subclass.

The code bellow works fine in Qt 4.8.6, in Qt 5.3.1 it Segfault.

Qt Code:
  1. ISCBase::ISCBase(QWidget *parent) : QDialog(parent)
  2. {
  3. setGeometry(0, 0, 768, 450);
  4.  
  5. this->installEventFilter(this);
  6. }
  7.  
  8. bool ISCBase::eventFilter(QObject *object, QEvent *event)
  9. {
  10. if (event->type() == QEvent::KeyPress) {
  11. QKeyEvent *keyEvent = (QKeyEvent*) event;
  12.  
  13. if ((keyEvent->key() == Qt::Key_Return) || (keyEvent->key() == Qt::Key_Enter)) {
  14. ISCBase *base = qobject_cast<ISCBase*>(object);
  15.  
  16. if (
  17. (base) && (
  18. (qobject_cast<QRadioButton*>(base->focusWidget())) ||
  19. (qobject_cast<QCheckBox*>(base->focusWidget())) ||
  20. (qobject_cast<QComboBox*>(base->focusWidget())) ||
  21. (qobject_cast<QDateEdit*>(base->focusWidget())) ||
  22. (qobject_cast<QDoubleSpinBox*>(base->focusWidget())) ||
  23. (qobject_cast<QFontComboBox*>(base->focusWidget())) ||
  24. (qobject_cast<QSlider*>(base->focusWidget())) ||
  25. #if QT_VERSION >= 0x050000
  26. (qobject_cast<QKeySequenceEdit*>(base->focusWidget())) ||
  27. #endif
  28. (qobject_cast<QLineEdit*>(base->focusWidget())) ||
  29. (qobject_cast<QRadioButton*>(base->focusWidget())) ||
  30. (qobject_cast<QSpinBox*>(base->focusWidget())) ||
  31. (qobject_cast<QTimeEdit*>(base->focusWidget())))
  32. ) {
  33. focusNextChild();
  34.  
  35. return true;
  36. }
  37. }
  38. }
  39.  
  40. return QObject::eventFilter(object, event);
  41. }
To copy to clipboard, switch view to plain text mode 

Any help will be welcome.