Results 1 to 8 of 8

Thread: QToolTip width

  1. #1
    Join Date
    Jan 2007
    Posts
    45
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default QToolTip width

    Hello !
    I'm using rich-text formated QToolTip and it seems that the width of tooltip is computed incorrectly: there is a lot of extra free space. My tooltip text looks like the following:
    Qt Code:
    1. <nobr><h4><u>name: Type</u></h4></nobr><br />name: value
    To copy to clipboard, switch view to plain text mode 
    Are there any ways to adjust tooltip width more precisely ?

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QToolTip width

    Quote Originally Posted by Vladimir View Post
    Hello !
    I'm using rich-text formated QToolTip and it seems that the width of tooltip is computed incorrectly: there is a lot of extra free space. My tooltip text looks like the following:
    Qt Code:
    1. <nobr><h4><u>name: Type</u></h4></nobr><br />name: value
    To copy to clipboard, switch view to plain text mode 
    Are there any ways to adjust tooltip width more precisely ?
    You can write qt html && make html -> table large xx pixel...
    To work on this html is you can build your hown editor... or....

    Qt Code:
    1. /* require qt2 && subversion svn */
    2.  
    3. mkdir tmp && cd tmp
    4. svn co https://qt-webdav.svn.sourceforge.net/svnroot/qt-webdav/html_editor/ html
    5. cd html
    6. qmake && make
    7. cd d*
    8. ./htmledit
    To copy to clipboard, switch view to plain text mode 

    On this tool you can switch source edit or Wysiwyg table & image ... only link href must make from hand.....



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

    Default Re: QToolTip width

    Quote Originally Posted by Vladimir View Post
    Hello !
    I'm using rich-text formated QToolTip and it seems that the width of tooltip is computed incorrectly: there is a lot of extra free space.
    Could we see a screenshot?

    What happens if you change the contents to:
    [html]<h4><u>name: Type</u></h4>
    <p>name: value</p>[/html]

  4. #4
    Join Date
    Jan 2007
    Posts
    45
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QToolTip width

    Could we see a screenshot?
    Yes, here is a screenshot with the following tooltip text:
    Qt Code:
    1. <h4><u>name: Type</u></h4>
    2. <p>name: value</p>
    To copy to clipboard, switch view to plain text mode 
    The same tooltip can be shown in treeview at the right, and there is exactly the same effect.
    Attached Images Attached Images

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

    Default Re: QToolTip width

    Did you try to limit the width with CSS? For example by using:
    [html]<h4 style="width: 100px;">xxx</h4>[/html]
    You can also try:
    [html]<h4 style="display:inline;">xxx</h4><br/>[/html]
    What happens if you omit the h4 tag completely?

  6. #6
    Join Date
    Jan 2007
    Posts
    45
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QToolTip width

    I've played more with it and found that:

    1. When using rich text the tooltip always has some minimal size: if text width is smaller than it there is extra free space, it text width is larger - everything is ok
    2. Each tag that adds new-line (<br />, <p>, <h1>, <table>, ...) increases this size
    3. "width" property and style is completely ignored

    You can reproduce it very easily: create any widget in Qt4 designer, assign tooltip with rich text to it, preview the widget and take a look at displayed tooltip.

    Maybe its time for bugreport ?

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

    Default Re: QToolTip width

    Maybe it is. Looks like the "page width" is too big but I can't decrease it in any way.

  8. #8
    Join Date
    Jan 2007
    Posts
    45
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QToolTip width

    I've just submitted bugreport to trolltech.
    Thanks for your attention.

Similar Threads

  1. How to draw lines with the right width?
    By albanelporto in forum Qt Programming
    Replies: 3
    Last Post: 22nd November 2006, 11:51
  2. QToolTip
    By suresh in forum Newbie
    Replies: 7
    Last Post: 6th September 2006, 15:00
  3. Change column width in a QTreeWidget
    By mace in forum Qt Programming
    Replies: 2
    Last Post: 27th May 2006, 12:19
  4. [QT3] QToolTip with Images (QPixMap) ?
    By BrainB0ne in forum Qt Programming
    Replies: 4
    Last Post: 27th January 2006, 08: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
  •  
Qt is a trademark of The Qt Company.