Results 1 to 2 of 2

Thread: width in QSimpleRichText

  1. #1
    Join Date
    Jan 2006
    Location
    Poland/Poznań
    Posts
    14
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default width in QSimpleRichText

    Hi!
    I have an image 640x480 (for example) and one code:
    Qt Code:
    1. QSimpleRichText *aaa = new QSimpleRichText("<img src=\"/path/to/my/image_640x480.jpg\">", font(), QString::null, 0);
    To copy to clipboard, switch view to plain text mode 
    and the second one:
    Qt Code:
    1. QSimpleRichText *bbb = new QSimpleRichText("<img src=\"/path/to/my/image_640x480.jpg\">", font(), QString::null, 0, QMimeSourceFactory::defaultFactory());
    To copy to clipboard, switch view to plain text mode 
    ...and results (varible: value):
    aaa->widthUsed(): 648
    aaa->width(): 644
    aaa->height(): 486
    bbb->widthUsed(): 656
    bbb->width(): 652
    bbb->height(): 486

    Who could tell me:
    1. Why none of these values is equal to image's sizes?
    2. Why values of "aaa" are different then "bbb's"?
    3. What can i do to give QSimpleRichText proper values (i mean equal to image's sizes)?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: width in QSimpleRichText

    My guess is that the dimensions returned include image spacing. Maybe you should just render your picture directly without using rich text?

Similar Threads

  1. How to set QTableView width to width of horizontal header?
    By martinb0820 in forum Qt Programming
    Replies: 0
    Last Post: 2nd December 2008, 20:51
  2. Replies: 4
    Last Post: 15th October 2008, 13:24
  3. Scaling of pen width in QGraphicsView
    By spuds in forum Qt Programming
    Replies: 3
    Last Post: 30th May 2008, 01:47
  4. QTableWidget column width and resizing
    By shooogun in forum Qt Programming
    Replies: 2
    Last Post: 16th March 2008, 22:31
  5. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 22:34

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.