Indicator signals

Catch the mouseclick!

Step 1: Connect the signal to the slot

Your editor fires the signalindicatorClicked anytime the user clicks on an indicator, and indicatorReleased at the end. It doesn’t matter which indicator he clicked on. These signals are sort of ‘global’ for the editor as a whole.
You need to connect the signal to a slot. A slot is just a Python function which you want to get called everytime the signal fires. This is how you do it:

So far, so good. Apart from some subtle syntactic differences, catching a mousclick on an indicator is quite similar to catching a mouseclick on a hotspot. But we’ll see in the next paragraph that indicators offer an awesome feature which is not available in the hotspot-mechanism!

Adding a value to an indicator when clicked

Indicators (more precisely: indicated-text) have the ability to store an integer value that can be retrieved when the text is clicked. We already touched this subject on the previous page. We discussed the (old-fashioned) way to apply an indicator on some text:

# Tell the editor which indicator-style to use
# (pass it the indicator-style ID number)self.__editor.SendScintilla(QsciScintilla.SCI_SETINDICATORCURRENT, indicator_number)
# Assign a value to the text you're going to indicateself.__editor.SendScintilla(QsciScintilla.SCI_SETINDICATORVALUE, value)
# Now apply the indicator-style on the chosen textself.__editor.SendScintilla(QsciScintilla.SCI_INDICATORFILLRANGE, start_pos, nr_of_chars)

Now to retrieve that value, you should implement your slot function like so: