PDA

View Full Version : Problems with QTextCursor::movePosition



js67257
22nd August 2006, 13:09
here:
bool mooved = cursor.movePosition(QTextCursor::Start);
while(mooved && cursor.position() < toPlainText().size()) {
cursor.select(QTextCursor::WordUnderCursor);
mooved = cursor.movePosition(QTextCursor::NextWord);
}

I have 2 questions:
1) mooved is always true even no more words left. At end of text. So I added "cursor.position() < toPlainText().size()". Is it right?
2) going throw this text "If you reimplement this handler, it is very important that you ignore() the event if you do not understand it, so that the widget's parent can interpret it" never ends and stay at "ignore".

Whats wrong?

wysota
23rd August 2006, 18:10
1) mooved is always true even no more words left. At end of text. So I added "cursor.position() < toPlainText().size()". Is it right?
I think so. It tells you that the operation did succeed and not if it changed the position of the cursor.


2) going throw this text "If you reimplement this handler, it is very important that you ignore() the event if you do not understand it, so that the widget's parent can interpret it" never ends and stay at "ignore".

Whats wrong?

What handler? What doesn't end and stays at ignore?