QTextCursor and QTextEdit
Unsolved
General and Desktop
-
Simple class inherited from QTextEdit
void XYZTextEdit::keyPressEvent(QKeyEvent *e) { QTextCursor tc = textCursor(); tc.select(QTextCursor::WordUnderCursor); qDebug() << tc.selectedText(); }
When i type word "window" - i got window as expeted
When I type word "1window" - i got 1window as expected
When I type word "[window" - i got window - why charcter "[" is missing ???
When I type word "win[dow" - i got dowPlease advise how I can get word from start to end
-
@aliks-os said in QTextCursor and QTextEdit:
i got window - why charcter "[" is missing ???
I guess because [ is not considered to be part of a word. But I don't know for sure, you can check how select() is implemented.