Yes, sorry. I was talking about Qt 4.
But how about QTextEdit::moveCursor() then?![]()
Yes, sorry. I was talking about Qt 4.
But how about QTextEdit::moveCursor() then?![]()
J-P Nurmi
hi...
yeah i found that. it works but not has that of our enter key....Also it works as our up down,back,forward arrows.i need to go the start of next line when i press the button...is it possible with the option setCursorPosition wherein we can place the cursor to the start of next line....?
i mean start of a new line. i used both QTextEdit::MoveDown and QTextEdit::MoveLineStart. the cursor only moves to existing line's start not to a new line...
"Enter" does something else than just go to the start of next line. It inserts a "\n" character in the text and this is what causes it to go to the beggining of the line, there is no "going down one line" - that's only a side effect.
If you want to mimic only the move itself, just use QTextEdit::MoveLineStart as the action for moveCursor() but if you don't have a line below, the cursor won't move because it doesn't have a place to move to - you have to add that new line there first.
hi....
yeah exactly . i tried that only.i inserted "\n" when i press the button. when i enter characters, they are displayed in the next line,but the cursor still blinks in the above line only....thats where i got stuck. i'm trying to bring cursor also down... here is my code:
void keyclass::enter()
{
str.append("\n");
text->moveCursor(QTextEdit::MoveDown,0);
text->moveCursor(QTextEdit::MoveLineStart,0);
}
str is a string . when i enter the keys in the keyboard(which i created, not the physicall connected keyboard), i'l store them in this string and display them in the textedit. so when i press enter i'l insert "\n" in the string . this causes the characters to go to the nextline while the cursor blinks in the previous. is this what u suggested...? or Am i missing something else...?
QTextEdit in Qt3 was somewhat buggy, so you might be experiencing some side effect.
Maybe instead of placing \n you should use QTextEdit::insertParagraph()?
hi...
its working successfully...thanks a lot to you and to everyone.....
Bookmarks