Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Best way to format text in this specific case (overlapping highlighting)?
ZeHgS last edited by ZeHgS
I am making a custom text editor with more complex formatting than I am used so I have a quick question. There are two types of keywords and I want my editor to highlight each keyword type in a different color. So far so good, that's easy. Now I also want it to highlight the whole sentence with a specific color depending on the type of keyword it contains, as well as the whole paragraph.
My question is can I begin by adding a format range for the whole paragraph, then go sentence by sentence and highlight those, then go word by word and highlight those ON TOP of the previous format ranges? Or do I have to do something like below, where each "break" in formatting is its own format range:
What I want, instead of having 5 format ranges like in the above image, is to have only 3. Is that possible?
What is the easiest way to accomplish what I need?
Thank you very much!
How your doing your highlighting currently ?
From the top of my head it should be doable. I would go in the order you just presented so that each style is apply on top of the previous one.
ZeHgS last edited by
Thank you so much for replying! I actually tried to do it this way when I had just started using QT and was unable to so I wanted to confirm I wasn't doing it wrong before attempting again. It worked now. Thank you so much!