I'm currently working on a text editor, I want to create an abbreviate system. I mean for example when you write html5 then press key tab for example you expand an code like this :
<html>
<body>
...
</body>
</html>
Maybe I used the wrong keyword but I don't know how to make a function like this. I found the QCompleter class but it seems more for completion than an abbreviate system.
Can anyone help me ? Best regards, zed13
Maybe you could define a bunch of constant strings that are literally the markups you want to use. E.g..:
const QString html5tab = "<html>\n\t<body>\n\t...\n\t</body>\n</html>";
I'm probably missing some necessary escapes, but that is the gist of it. Then write your program so that when the tab button gets pressed, the variable html5tab
gets printed to the text edit field.
Anyway, that's the first thing that comes to mind.