Results 1 to 12 of 12

Thread: Turning off ToolTips

  1. #1
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Turning off ToolTips

    Hi,

    Is it possible to turn off tooltips for certain widgets? Reason is, I have a custom tooltip which is not displaying and just wondered if it is because of the 'built-in' ones?

    Regards,
    Steve

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Turning off ToolTips

    How did you set the custom tool tip?

  3. #3
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Turning off ToolTips

    Hi Marcel,

    I was going to try use a delegate which would then display a custom tooltip. The tooltip I was going to use was from CVXPTooltipManager class ( http://www.tooltips.net) but unfortunately it isn't going to work, it is mainly catered for MFC/ATL apps.

    Is it possible to code your own tooltip widget?

    Regards,
    Steve

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Turning off ToolTips

    Of course, you could create some custom widget which you can show. You could do custom painting in paintEvent();
    But make sure to set the Qt::Tooltip flag when you create it.

    Regards

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Turning off ToolTips

    Catch QEvent::TooplTip to show custom tooltips. See Tooltips Example.
    J-P Nurmi

  6. The following user says thank you to jpn for this useful post:

    steg90 (16th May 2007)

  7. #6
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Turning off ToolTips

    Thanks Marcel,

    Being quite new to Qt, I'm not sure how to do this yet? . I guess I derive from QWidget, obviously override the paintEvent, mouseMoveEvent and mousePressEvent. Even if I did the custom tooltip, I still unsure how to connect it to my tableview, my thought was to not use the default delegate for the Qt::ToolTipRole and use my own?

    Regards,
    Steve

  8. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Turning off ToolTips

    Correct! All you need to do is override paintEvent.
    Setting Qt::Tooltip will take care of the rest.

  9. #8
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Turning off ToolTips

    Thanks again,

    How do I set Qt::Tooltip?

    Regards,
    Steve

  10. #9
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Turning off ToolTips

    When you create the widget. The first parameter is the parent, the second is the window flags. It is an OR-ed combination of window flags.

    See Qt::WindowFlags

  11. The following user says thank you to marcel for this useful post:

    steg90 (16th May 2007)

  12. #10
    Join Date
    Apr 2007
    Posts
    44
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Turning off ToolTips

    Qt already support html tooltip,tranparent ,that make very customize look and feel.
    If it not enough you even can custom draw ,in simple subclass painEvent.

    I think no need to use third party tooltip.

  13. The following user says thank you to Teerayoot for this useful post:

    steg90 (16th May 2007)

  14. #11
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Turning off ToolTips

    What about using bool QAbstractItemView::viewportEvent ( QEvent * event ) in my TableView? I guess I could write a class which derives from QTableView and override this event?

    Regards,
    Steve

  15. #12
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Turning off ToolTips

    Quote Originally Posted by steg90 View Post
    What about using bool QAbstractItemView::viewportEvent ( QEvent * event ) in my TableView? I guess I could write a class which derives from QTableView and override this event
    Yes, that's the correct place (and also where QAbstractItemView implements the default tooltip behaviour). Just be sure to pass all others but the interesting tooltip events to the base class implementation.
    J-P Nurmi

  16. The following user says thank you to jpn for this useful post:

    steg90 (17th May 2007)

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.