Hello, I want to apply a TextFormat (QTextFormat) to the cursor in a QTextEdit widget, but in that way that if there is no selection and word under the cursor, the format to be applied on the text that would follow. If I select color Green from a QWidgetAction object, and there is no word under the cursor nor a selection, the Green to be applied on the word that I would start typing after the selection is done.

I tried with setCharFormat, mergeCharFormat and simillar methods, but the formatting is not taken in consideration, but previous formatting is applied on the new typed text.

Thanks in advance.