Show no autocomplete popup after evaluate
Originally reported on Google Code with ID 46
it is annoying when the last item in the editor contains something that
triggers the autocompletion. when you evaluate, the textChanged event
triggers, because in returnPressed, we use d->editor->setText() so the
autocomplete triggers. Simple solution is to disable autocompletion at
beginning of function and restore it then afterwards.
This is the function I changed in crunch.cpp
void Crunch::returnPressed()
{
bool bAutoCompletion = d->editor->autoCompleteEnabled();
d->editor->setAutoCompleteEnabled(false);
QString str = Evaluator::autoFix( d->editor->text(),
Settings::self()->decimalPoint );
if( str.isEmpty() )
{
d->editor->setAutoCompleteEnabled(bAutoCompletion);
return;
}
d->eval->setExpression( str );
d->editor->appendHistory( str );
d->historyDock->setHistory( d->editor->history() );
HNumber result = d->eval->eval();
if( !d->eval->error().isEmpty() )
d->result->appendError( str, tr( "Error: %1" ).arg( d->eval->error() ) );
else
{
d->result->append( str, result );
d->editor->setAnsAvailable( true );
d->variablesDock->updateList( d->eval );
}
d->editor->setText( str );
d->editor->selectAll();
d->editor->stopAutoCalc();
d->autoAns = true;
d->editor->setAutoCompleteEnabled(bAutoCompletion);
QTimer::singleShot( 0, d->editor, SLOT(setFocus()) );
if( !isActiveWindow () )
activateWindow();
}
Reported by deblauwetom
on 2007-06-01 07:51:26
Comments (8)
-
Account Deleted -
Account Deleted ``` Hello,
The problem is: the textchanged slot is triggered, because you use d->editor->setText I think. ```
Reported by `deblauwetom` on 2007-06-12 08:22:15
-
Account Deleted ``` Yes, but the stopAutoCalc() should stop it.
I try to reproduce it, but I can't. Could you give me an example of an expression which causes this problem? Perhaps I am missing something here. ```
Reported by `ariya.hidayat` on 2007-06-12 08:26:22
-
Account Deleted ``` so the simulation is for example: t = 3<enter> 6 * t<the popup shows><enter or escape to clear it><enter to evaluate> <the popup shows again!> ```
Reported by `deblauwetom` on 2007-06-12 08:26:41
-
Account Deleted ``` isn't the problem that you stop the autocalc, but not the autocomplete? ```
Reported by `deblauwetom` on 2007-06-12 08:32:40
-
Account Deleted ``` OK, now I see why I understood it wrongly.
I just commit the fix by adding stopAutoComplete() to the editor.
Thanks a lot ! ```
Reported by `ariya.hidayat` on 2007-06-12 08:47:49 - Status changed: `Fixed`
-
repo owner -
repo owner - changed status to closed
- Log in to comment
``` Could you kindly describe step-by-step on how to reproduce this?
In theory, this should not happen because the editor has the stopAutoCalc() function. So perhaps we miss something here. ```
Reported by `ariya.hidayat` on 2007-06-12 07:58:44 - Labels added: Milestone-0.8