[Interest] Fwd: programatically adding a list to a QTextDocument

Gopalakrishna Bhat gopalakbhat at gmail.com
Fri Jan 13 14:02:18 CET 2012


Ah..Sorry made a personal post :)

---------- Forwarded message ----------
From: Gopalakrishna Bhat <gopalakbhat at gmail.com>
Date: Fri, Jan 13, 2012 at 6:31 PM
Subject: Re: [Interest] programatically adding a list to a QTextDocument
To: Graham Labdon <Graham.Labdon at avalonsciences.com>


QTextCursor has insertBlock method that you can use to insert into the
document.

One way of adding a block to the document is

    QTextCharFormat textCharFormat = cursor.blockCharFormat();
    QTextBlockFormat blockFormat;
    cursor.insertBlock(blockFormat,textCharFormat);
    cursor.insertText("Text to be inserted");

Then you get that block and then use that in QTextList::add . Hope this
helps.

Gopalakrishna

On Fri, Jan 13, 2012 at 5:40 PM, Graham Labdon <
Graham.Labdon at avalonsciences.com> wrote:

>  Hi****
>
> I want to add a QTextList to a document.****
>
> I see that I can do this using QTextCursor::insertList.****
>
> This returns a pointer to the new list but I cannot see a way to  add
> items to the list.****
>
> QTextList has an ‘add’ method that takes a QTextBlock but I cannot see how
> to create a text block with the desired text for the list entry****
>
> ** **
>
> Any help is appreciated****
>
> Graham ****
>
> ** **
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>


-- 
My blog http://gkbhat.blogspot.com



-- 
My blog http://gkbhat.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120113/d5224b2b/attachment.html>


More information about the Interest mailing list