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. Adding a tooltip in QPlainTextEdit
Forum Updated to NodeBB v4.3 + New Features

Adding a tooltip in QPlainTextEdit

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.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.
  • F Offline
    F Offline
    Forgive
    wrote on last edited by
    #1

    Well i've got a way to do this, however i "don't like it". I'm trying to find out a way to make a QToolTip when you put the mouse over some text (reading that text, obviously.) in a QPlainTextEdit. My way works like that, just that i select the text under cursor by doing cursor.select(), and if i move the mouse outside the text the tooltip stays there until i go to another word.

    1 Reply Last reply
    0
    • O Offline
      O Offline
      OlivierB
      wrote on last edited by
      #2

      I do not know QPlainTextEdit that much but maybe you can try with "cursorForPosition()":http://developer.qt.nokia.com/doc/qt-4.8/qplaintextedit.html#cursorForPosition? And then with the QTextCursor you can get the block underneath.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        miroslav
        wrote on last edited by
        #3

        I think a better approach is to listen to tooltip events, and then set the widgets tooltip dynamically when the event is received, depending on the pointer position. There is some reference here: http://developer.qt.nokia.com/doc/qt-4.8/widgets-tooltips.html

        Mirko Boehm | mirko@kde.org | KDE e.V.
        FSFE Fellow
        Qt Certified Specialist

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Forgive
          wrote on last edited by
          #4

          Hm, i see. So that's the only way, thanks. :)

          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