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...
{
int key = e->key();
//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);
}
}
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);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks