Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Create F1 key in tooltip (similar to qtcreator)
Qt 6.11 is out! See what's new in the release blog

Create F1 key in tooltip (similar to qtcreator)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rno1
    wrote on last edited by
    #1

    Hi,

    I have been searching for the past few days but I cannot figure out on how to do it. I would like to do reproduce a behavior similar to the newest qtcreator where a F1 hint is shown in tooltip and allows you to show full help in a context sensitive manner by pressing F1 while the tooltip is displayed.

    Has anyone tried yet to get the same tooltip feature in their programs?

    Cheers,
    Rno

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Code_ReaQtor
      wrote on last edited by
      #2

      I haven't done it in action but this might give you some hint

      Implement "hoverEvent" on your editor

      Look for the word below the mouse (e.g. QTextCursor::WordUnderCursor is a possible way)

      You should have some "keywords" to check if it points to a specific "help/tooltip" (it is up to you to implement)

      Implement "keyPressEvent" and wait for "Qt::Key_F1"

      The rest is up to you...

      Cheers!!!

      Please visit my open-source projects at https://github.com/Code-ReaQtor.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rno1
        wrote on last edited by
        #3

        I have the downstream documentation files in qt format and it works well with my kewords. But isn't QTextCursor only for QTextDocument? I want to act on widgets tooltips.

        Anyone else with some ideas?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Code_ReaQtor
          wrote on last edited by
          #4

          Nope, it is supported by "QTextEdit":http://qt-project.org/doc/qt-4.8/qtextedit.html, etc. (AFAIK, all Qt classes that were designed to edit texts support this)

          Please visit my open-source projects at https://github.com/Code-ReaQtor.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved