[Qt-interest] Match new line character
Israel Brewster
israel at frontierflying.com
Thu Mar 26 19:57:44 CET 2009
I have a QTextEdit widget in my app where I need to watch what the
user types, and if they type certain characters I need to respond in
various ways. What I have done so far is connected a slot to the
textChanged() signal, such that whenever they type a character I use
the QTextCursor to select the last character (whatever they just
typed, obviously) and compare it to the set of "action" characters.
This works fine for normal characters (if there is a better way, I'd
love to hear it) but it doesn't appear to work if they type a new line
(return or enter, I don't care which). I tried comparing to "\n", but
the comparison always fails. In the debugger, the selected string
looks like "\e2\80\a9" in this case. I was thinking maybe that was
just random junk, except that I always get that same string. How can I
match on a new line? Thanks.
-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
More information about the Qt-interest-old
mailing list