i have a class derived from QPlainTextEdit, and it has a QCompleter.
when the completer's popup is visible and i press a key, the program crashes.

my KeyPressedEvent:
(it doesn't handle input yet, just shows or insert selection)
Qt Code:
  1. void CodeEditor::keyPressEvent(QKeyEvent *e)
  2. {
  3. if(mCompleter->popup()->isVisible())
  4. {
  5. switch(e->key())
  6. {
  7. case Qt::Key_Escape:
  8. mCompleter->popup()->setVisible(false);
  9. return;
  10. case Qt::Key_Enter:
  11. case Qt::Key_Return:
  12. case Qt::Key_Tab:
  13. case Qt::Key_Backtab:
  14. e->ignore();
  15. return;
  16. default:
  17. break;
  18. }
  19. }
  20. else
  21. {
  22. switch(e->key())
  23. {
  24. .....
  25. }
  26. }
  27. QPlainTextEdit::keyPressEvent(e);
  28. }
To copy to clipboard, switch view to plain text mode 

the stack trace:
Qt Code:
  1. 0 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data qscopedpointer.h 135 0x6a2a48be
  2. 1 qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > > qglobal.h 2314 0x6a10f2db
  3. 2 QObject::d_func qobject.h 125 0x6a28fd68
  4. 3 QCoreApplication::notifyInternal qcoreapplication.cpp 712 0x6a1fd43f
  5. 4 QCoreApplication::sendEvent qcoreapplication.h 215 0x00e7955a
  6. 5 QCompleter::eventFilter qcompleter.cpp 1313 0x00df9743
  7. 6 QCoreApplicationPrivate::sendThroughObjectEventFilters qcoreapplication.cpp 841 0x6a1fd711
  8. 7 QApplicationPrivate::notify_helper qapplication.cpp 4298 0x00822505
  9. 8 QApplication::notify qapplication.cpp 3765 0x00820187
  10. 9 QCoreApplication::notifyInternal qcoreapplication.cpp 726 0x6a1fd47a
  11. 10 QCoreApplication::sendEvent qcoreapplication.h 215 0x00e7955a
  12. 11 QShortcutMap::tryShortcutEvent qshortcutmap.cpp 340 0x0084f549
  13. 12 QApplication::notify qapplication.cpp 3748 0x00820072
  14. 13 QCoreApplication::notifyInternal qcoreapplication.cpp 726 0x6a1fd47a
  15. 14 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 218 0x00e79506
  16. 15 QETWidget::sendSpontaneousEvent qkeymapper_win.cpp 571 0x00f54248
  17. 16 QKeyMapper::sendKeyEvent qkeymapper_win.cpp 1195 0x008a28ef
  18. 17 QKeyMapperPrivate::translateKeyEvent qkeymapper_win.cpp 1094 0x008a2406
  19. 18 QtWndProc@16 qapplication_win.cpp 1739 0x00883a13
  20. 19 USER32!IsWindowVisible C:\Windows\system32\user32.dll 0 0x76e286ef
  21. 20 ?? 0 0x000c054c
  22. ... <More>
To copy to clipboard, switch view to plain text mode