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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -