qt - Selecting non-alpha chars with QTextCursor -
i'm trying add syntax completion qtextedit base editor , i'd support non-alpha characters trigger qcompleter popup. i'm using qtextcursor::select current word filtering out non-alpha characters. there option need use ?
here's code use text:
qtextcursor tc = textcursor(); tc.select(qtextcursor::wordundercursor); qstring t = tc.selectedtext();
thanks
words not contain alpha characters. select last input character:
qtextcursor tc = textcursor(); tc.moveposition ( qtextcursor::left, qtextcursor::keepanchor); qchar lastchar = tc.selectedtext().at(0); if (!lastchar.isletterornumber()) { something; }
replace isletterornumber() whatever characters might check for.
Comments
Post a Comment