[QScintilla] Clickable functions and variables
Matic Kukovec
kukovecmatic at hotmail.com
Wed Oct 12 19:08:55 BST 2016
Hey Kristof,
Hotspots make text clickable. You have to style it manualy using the QScintilla.SendScintilla function.
Example function I used in my editor Ex.Co. (https://github.com/matkuki/ExCo):
def style_hotspot(self, index_from, length, color=0xff0000):
"""Style the text from/to with a hotspot"""
send_scintilla =
#Use the scintilla low level messaging system to set the hotspot
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_STYLESETHOTSPOT, 2, True)
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETHOTSPOTACTIVEFORE, True, color)
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETHOTSPOTACTIVEUNDERLINE, True)
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_STARTSTYLING, index_from, 2)
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETSTYLING, length, 2)
This makes text in the QScintilla editor clickable when you hover the mouse over it.
The number 2 in the above functions is the hotspot style number.
To catch the event that fires when you click the hotspot, connect to these signals:
QScintilla.SCN_HOTSPOTCLICK
QScintilla.SCN_HOTSPOTDOUBLECLICK
QScintilla.SCN_HOTSPOTRELEASECLICK
For more details look at Scintilla hotspot documentation:
http://www.scintilla.org/ScintillaDoc.html#SCI_STYLESETHOTSPOT
and QScintilla hotspot events:
http://pyqt.sourceforge.net/Docs/QScintilla2/classQsciScintillaBase.html#a5eff383e6fa96cbbaba6a2558b076c0b
Try it. Hope it helps.
Matic
________________________________
From: QScintilla <qscintilla-bounces at riverbankcomputing.com> on behalf of kristof.mulier at telenet.be <kristof.mulier at telenet.be>
Sent: Wednesday, October 12, 2016 5:33 PM
To: qscintilla at riverbankcomputing.com
Subject: [QScintilla] Clickable functions and variables
Dear QScintilla users and developers,
Can you please take a look at this StackOverflow question?
http://stackoverflow.com/questions/40002373/qscintilla-based-text-editor-in-pyqt5-with-clickable-functions-and-variables
I am still trying to build an IDE in PyQt5, and use QScintilla for the syntax highlighting. I wonder if certain features are available in QScintilla. The official documentation is way too short.
Kind greetings,
Kristof Mulier
PS: The IDE I am building can be found on my website: www.gneb.io<http://www.gneb.io>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/qscintilla/attachments/20161012/2643cc1a/attachment.html>
More information about the QScintilla
mailing list