PDA

View Full Version : reading the latest entry text from QplaintextEdit



PHANI
5th February 2012, 05:40
hi, i am trying to implement shell application..presently i am using Qlineedit for command entry and QTextedit for displaying the command output..it is looking ugly ..i want to use QPlaintextEdit for both command entry and display output...can some one please tell me how to do this..

QPlaintext


tcl>puts helloworld //command entry
helloworld //command output
tcl> // ready for taking next command

wysota
6th February 2012, 01:03
What's the problem?

PHANI
6th February 2012, 06:58
i want read the perticular text from Qtextedit...i just reimplemnted keypressevents my back speace operation is not working properly it is not removing the last letter...




void textedit::keyPressEvent(QKeyEvent *e)
{
int key = e->key();
QString str = e->text();

//updateCursor();
if ((key == Qt::Key_Return) || (key == Qt::Key_Enter) ) {
qDebug()<<input<<endl;
}
else if ((key == Qt::Key_Backspace) ) {
// remove last letter from the input string
//input.remove(-1,1);
}
else {
insertPlainText(str);
input.insert(-1,str);

}


}

wysota
6th February 2012, 11:30
Doesn't QPlainTextEdit already handle key events by itself?