Results 1 to 4 of 4

Thread: how to find rect of every line in multiline word wrapped string?

  1. #1
    Join Date
    Jul 2010
    Posts
    41
    Thanks
    6
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question how to find rect of every line in multiline word wrapped string?

    I have a QTableWidget with 'Word Wrap' enabled, and also I installed an item delegation on it. when reimplementing:

    Qt Code:
    1. QStyledItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index )
    To copy to clipboard, switch view to plain text mode 

    the 'option.rect' give me whole item 'rect' but I want rect of an arbitrary line of text.
    How can I do that?

  2. #2
    Join Date
    Jul 2010
    Posts
    41
    Thanks
    6
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to find rect of every line in multiline word wrapped string?

    See the screenshot for a better description of my question, please.
    word-wrap-qtableview.png

  3. #3
    Join Date
    Jul 2010
    Posts
    41
    Thanks
    6
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to find rect of every line in multiline word wrapped string?

    Nobody has an idea?

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to find rect of every line in multiline word wrapped string?

    May be calculate yourself...
    you have the width of text.... you know the height of font..
    so you can calculate the rect of any line..

  5. The following user says thank you to aamer4yu for this useful post:

    srazi (9th February 2011)

Similar Threads

  1. QString find Whole word Only
    By bcteh_98 in forum Qt Programming
    Replies: 9
    Last Post: 7th December 2018, 08:47
  2. How to split a string line
    By grsandeep85 in forum Newbie
    Replies: 5
    Last Post: 29th July 2009, 10:42
  3. How to split a string line
    By grsandeep85 in forum Qt Programming
    Replies: 2
    Last Post: 29th July 2009, 10:28
  4. Simple word-wrapped popup box
    By hardgeus in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2008, 20:01
  5. QT string Find problem
    By kingslee in forum Qt Programming
    Replies: 2
    Last Post: 16th October 2006, 20:45

Tags for this Thread

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.