On Sunday 15 December 2024 18:07:46 Central European Standard Time Wang Gary 
wrote:
> Hi again,
> 
> > > > Replace the non-visible character in the model with a visible one in
> > > > the
> > > > view?
> > > 
> > > Well, there are some reasons that I personally would like to avoid
> > > that. Firstly this
> > > feature itself is more of a view-level function, modifying the model
> > > sounds weird[1].
> > 
> > My suggestion wasn't to replace them in the model, but to replace them in
> > the view.
> 
> I'm a little confused, the whole set of QTextLayout API doesn't seems to be
> a model/view structure, and by looking into the KTextEditor I also didn't
> find any model/view related stuff in the textlayout-related code. Did I
> miss something?
> 
You can always add another model level. 

Data model -> View model -> View

But since you want to edit it, it is probably too cumbersome. Of your two 
suggested approached I think the QTextLayout has the best chance of working. 
One of the problems with QTextEdit is that it is a rich text editor, so it 
will collapse white spaces in rich text mode, and probably collapses zero-
space whitespace even in plaintext mode. Which means if you replace the font, 
the zero space characters could already be handled an never looked up in the 
font.

I would look up how QtCreator and KWrite handles emoticons, and similar fancy 
text tricks. Emoticons are when text smileys : ) are replaced at editing time 
with emojis. This type of replacement sounds similar to what you need.

Best regards
Alkan


_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to