Results 1 to 3 of 3

Thread: QGraphicsItem::setToolTip does not work

  1. #1
    Join Date
    Aug 2009
    Location
    Lviv
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsItem::setToolTip does not work

    Hi,

    I have an item dierived from QGraphicsItem.

    and I want a toolTips for this item

    Qt Code:
    1. hotPoint::hotPoint(const QPointF& hotPoint)
    2. {
    3. setAcceptHoverEvents(true);
    4. setToolTip("An important value");
    5. point = hotPoint;
    6. }
    To copy to clipboard, switch view to plain text mode 

    what else I should do to make toolTip shown?

  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: QGraphicsItem::setToolTip does not work

    You might want to call the base class implementation of the constructor. Apart from that you need to define boundingRect() properly and add the item to the scene.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2009
    Location
    Lviv
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsItem::setToolTip does not work

    Hi,

    Thanks for replay. I have added the item to scene and define boundingRect() properly but I found in docs that also need to set

    Qt Code:
    1. setAttribute( Qt::WA_AlwaysShowToolTips)
    To copy to clipboard, switch view to plain text mode 


    Note that by default tooltips are only shown for widgets that are children of the active window. You can change this behavior by setting the attribute Qt::WA_AlwaysShowToolTips on the window, not on the widget with the tooltip.

    I set this property to view and to main window cause I don't know who actually are active

Similar Threads

  1. Making MySQL plugin work on a windows x86 enviroment
    By Baasie in forum Installation and Deployment
    Replies: 1
    Last Post: 2nd September 2009, 15:15
  2. getting MySQL to work with Qt
    By Ashish in forum Installation and Deployment
    Replies: 7
    Last Post: 19th May 2009, 08:57
  3. Qt4 : QPainter::setRedirected doesn't work
    By Ankitha Varsha in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2008, 17:52
  4. QActions don't work with menubar hidden
    By Pepe in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 01:04
  5. Change work area OS
    By pakulo in forum Qt Programming
    Replies: 15
    Last Post: 15th May 2007, 07:20

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.