[Qt-interest] auto closing xml tags
Nesbitt
none at none.no
Mon Aug 23 18:22:25 CEST 2010
poniedziałek, 23 sierpnia 2010 09:05 - Mark Summerfield
> On Sun, 22 Aug 2010 22:39:18 +0200
> Nesbitt <none at none.no> wrote:
>> Hi
>>
>> I am using QTextEdit as xml editor. I'd like to implement auto
>> closing tags.
>>
>> For example when user types <tag1 arg1="val1"> QTextEdit should
>> insert </tag1> after cursor.
>>
>> I've read QCompleter docs and as I understood it I cannot use it
>> because there is no list of valid words (every string could be a tag
>> name).
>>
>> What is the best way to do this?
>
> One approach you might try is to subclass QTextEdit and reimplement the
> keyPress() event handler. In that handler detect the insertion of a '>'
> character.
Thanks. I'll try this.
More information about the Qt-interest-old
mailing list