Fixed crash in completer of MimeTextEdit (Patch from Phenom)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6483 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-07-06 15:17:34 +00:00
parent 4ce08bee38
commit e9db631f8f

View File

@ -33,6 +33,8 @@ MimeTextEdit::MimeTextEdit(QWidget *parent)
{
mCompleterKeyModifiers=Qt::ControlModifier;
mCompleterKey=Qt::Key_Space;
mForceCompleterShowNextKeyEvent=false;
mCompleterStartString="";
}
bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
@ -150,13 +152,15 @@ void MimeTextEdit::keyPressEvent(QKeyEvent *e)
if (!mCompleter || !isShortcut) // do not process the shortcut when we have a completer
QTextEdit::keyPressEvent(e);
if (!mCompleter) return; //Nothing else to do if not mCompleter initialized
if (!isShortcut && (mCompleter && !mCompleter->popup()->isVisible())) {
return;
}
if (!mForceCompleterShowNextKeyEvent) {
static QString eow(" ~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="); // end of word
if (!isShortcut && ( e->text().isEmpty() || eow.contains(e->text().right(1)))){
if (!isShortcut && !e->text().isEmpty() && eow.contains(e->text())){
mCompleter->popup()->hide();
return;
}