[QScintilla] showing ToolTips dinamically

Phil Thompson phil at riverbankcomputing.com
Wed Nov 5 23:03:18 GMT 2008


On Wed, 05 Nov 2008 23:50:42 +0100, Andrea Battisti <battisti at actgate.com>
wrote:
> Hi All,
> 
> is it possible to pop-up a tooltip within a QSciScintilla editor widget?
> 
> I was thinking to use the QToolTip class from Qt to draw a tooltip
> dinamically, based on the current mouse position.
> 
> The problem is that the ToolTip needs to be associated to a rectangle
> within the widget, and I am not seeing a way to go from the mouse
> position to the word under the cursor.
> 
> I checked the QScintilla API docs and I only found the lineAt( QPoint& )
> method that gives back the line where the cursor is pointing at.
> Is there a way to find also the word? (the column positions?)
> And is there a way then to get the QRect corresponding to that specific
> word?
> 
> For example, a use case would be the following: when the mouse is held
> for a second or two over a word, then a pop-up could appear showing
> context-specific information on that word.

You could have a look at the Scintilla SCI_POSITIONFROMPOINT command.

Phil


More information about the QScintilla mailing list