All pastes #475463 Raw Edit

katapult

public cpp v1 · immutable
·published 2007-05-07 13:34 UTC
rendered paste body
void Katapult::keyReleased(QKeyEvent *e){        if(e->key() == Key_BackSpace) {                if(hideTimer->isActive())                        hideTimer->stop();                if(clearTimer->isActive())                        clearTimer->stop();                QString newQuery = _query.left(_query.length()-1);                setQuery("");                setQuery(newQuery);        } else if (e->key() == Key_Tab) {                int ascii = 97;                setQuery(_query + (char) ascii);                printf("%d\n",bestMatch.isNull());                while(bestMatch.isNull() && ascii <= 122) {                        ascii++;                        _query = _query.left(_query.length()-1);                        if (ascii == 123)       break;                        setQuery(_query + (char) ascii);                        sleep(1);                        printf("%d ... %c := %d\n",_query.length(),ascii,bestMatch.isNull());                }        } else {                QString t = e->text();                if ( !t.isEmpty() && (!e->ascii() || e->ascii()>=32) &&                                    e->key() != Key_Delete)                        setQuery(_query + t);        }}