Results 1 to 2 of 2

Thread: Links inside view

  1. #1
    Join Date
    Feb 2006
    Location
    Warsaw, Poland
    Posts
    45
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Links inside view

    Hi there, i'm trying to display links inside TreeView with my custom model.

    1. Item has element QTextDocument *doc;
    2. doc contains HTML content ( i.e <a href="http://link">http://link</a>).
    3. delegate accesses items doc and uses doc->drawContents( painter, option.rect )

    I think it should paint document contents inside of view but it doesn't... in the place where it should be painted there is empty hole (i'm using QTextDocument::size and QTextDocument::setTextWidth to caclulate size hint). I know how to handle clicks on link with eventFilter etc. but i have no idea why it doesn't want to paint inside view. any ideas?

  2. #2
    Join Date
    Feb 2006
    Location
    Warsaw, Poland
    Posts
    45
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Links inside view

    Here is some code:

    delegate:
    Qt Code:
    1. rosterItem *item = static_cast<rosterItem*> (index.internalPointer());
    2. item->descr->setHtml( "<a href=\"http://link\">http://link</a>" );
    3. item->descr->drawContents( painter, QRectF( 0,(qreal)( index.row()*20 ),100,20 ) );
    To copy to clipboard, switch view to plain text mode 

    That's all what delegate does, it should draw link for each item but it doesn't. in list i have something like 8 items. (items with different background are "groups" in this tree view) but link is painted only ONCE. maybe it's some kind of Qt bug?
    Attached Images Attached Images

Similar Threads

  1. [Qt4.1] How to insert an image inside a Form?
    By Gonzalez in forum Qt Tools
    Replies: 5
    Last Post: 23rd September 2008, 11:20
  2. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19
  3. Model - View Programming doubt.
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2006, 13:01
  4. Replies: 6
    Last Post: 20th April 2006, 10:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.