Results 1 to 4 of 4

Thread: How to set the tooltip of a qtreeview items on mouse over.

  1. #1
    Join Date
    Aug 2012
    Posts
    29
    Thanked 2 Times in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question How to set the tooltip of a qtreeview items on mouse over.

    Hi all,

    I have a Qtreeview and I want to set the tooltip on mouse over. I am able to set the tooltip for each item. Now I have two concerns
    1. I want to display the tooltip only for those items whose text is truncated.
    2. I want to display the tooltip on the mouseover.

    currently tooltip of that item is being shown which one is selected doesn't matter which item mouse pointer is on.

    Thanks for your help in advance

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to set the tooltip of a qtreeview items on mouse over.

    Last edited by spirit; 23rd August 2012 at 15:07.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Aug 2012
    Posts
    29
    Thanked 2 Times in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question Re: How to set the tooltip of a qtreeview items on mouse over.

    Quote Originally Posted by spirit View Post
    thanks for reply...
    here is wat i am doing..

    ui->mytreeView->setToolTip(index.model()->data(index,Qt:isplayRole).toString());

    i want to set the tooltip only for the text which are going beyond the column width.
    how to do that..I can have the column width here but how can I get the text width here?

  4. #4
    Join Date
    Oct 2011
    Posts
    27
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set the tooltip of a qtreeview items on mouse over.

    hi !

    ui->mytreeView->setToolTip() ... you're setting a tooltip for the whole treeview ...

    If you want to get helped, you need to tell us more about the model/view subclasses you're using !

    anyway, look at your model instead than your view to set a specific tooltip for each item

Similar Threads

  1. Creating a Tooltip-like widget for mouse-hover of QListView items
    By TropicalPenguin in forum Qt Programming
    Replies: 4
    Last Post: 26th November 2011, 05:14
  2. Replies: 0
    Last Post: 15th April 2011, 19:04
  3. Replies: 2
    Last Post: 20th August 2010, 05:18
  4. Get rid of the frame around items in the QTreeView
    By THRESHE in forum Qt Programming
    Replies: 3
    Last Post: 10th December 2008, 18:00
  5. How to clear All items on QTreeView ?
    By qintm in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2006, 11:39

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.