PDA

View Full Version : QCompleter related crash



jajdoo
23rd July 2010, 17:55
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)


void CodeEditor::keyPressEvent(QKeyEvent *e)
{
if(mCompleter->popup()->isVisible())
{
switch(e->key())
{
case Qt::Key_Escape:
mCompleter->popup()->setVisible(false);
return;
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Tab:
case Qt::Key_Backtab:
e->ignore();
return;
default:
break;
}
}
else
{
switch(e->key())
{
.....
}
}
QPlainTextEdit::keyPressEvent(e);
}


the stack trace:

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

jajdoo
24th July 2010, 07:50
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)

jajdoo
24th July 2010, 09:03
ok..........
that's embracing.

forgot to ->setWidget....