Results 1 to 3 of 3

Thread: QCompleter related crash

  1. #1
    Join Date
    Jul 2010
    Posts
    63
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QCompleter related crash

    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 

  2. #2
    Join Date
    Jul 2010
    Posts
    63
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QCompleter related crash

    im really lost here.. anyone has at least a hunch about what could be wrong?
    i tried using the ->complete method, and that causes a crash without any debug information at all.
    one thing i've noticed is that the popup doesn't show at the bottom of the document when i show it (like it would if no QRect was declared when calling ->complete)

  3. #3
    Join Date
    Jul 2010
    Posts
    63
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QCompleter related crash

    ok..........
    that's embracing.

    forgot to ->setWidget....

Similar Threads

  1. a smarter QCompleter
    By ber_44 in forum Qt Programming
    Replies: 7
    Last Post: 30th March 2011, 07:10
  2. QCompleter & ToolTip
    By nanortemis in forum Qt Programming
    Replies: 3
    Last Post: 25th September 2009, 19:54
  3. QTextEdit and QCompleter
    By nivel in forum Qt Programming
    Replies: 2
    Last Post: 14th June 2009, 03:18
  4. Replies: 1
    Last Post: 12th October 2008, 08:21
  5. QTextEdit with QCompleter
    By No-Nonsense in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2007, 14:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.