Question

I want to know why marker number is used and how from 1 to 31 marker numbers are different from each other. And how to add a custom marker symbol like with gradient,Pix map or an image etc for example these Blue glittery Dots in the given image.:-
margin design pyqt4

marker is defined in the following code:-

 CIRCLE_MARKER_NUM = 0
......
def __init__(self, parent=None):
   super(SimplePythonEditor, self).__init__(parent)
   self.markerDefine(QsciScintilla.Circle,self.CIRCLE_MARKER_NUM)
   self.setMarkerBackgroundColor(QColor(66, 66, 255),self.CIRCLE_MARKER_NUM)
   ......

def on_margin_clicked(self, nmargin, nline, modifiers):
    # Toggle marker for the line the margin was clicked on
    if self.markersAtLine(nline) != 0:
        self.markerDelete(nline, self.CIRCLE_MARKER_NUM)
    else:
        self.markerAdd(nline, self.CIRCLE_MARKER_NUM)
Was it helpful?

Solution

The answer to the question "why marker number is used" is simply: why not? Some sort of identifier has to be used, and a number seems a perfectly reasonable choice.

The only markers that have a pre-defined meaning are the numbers 25 to 31, which are used for the fold-margin symbols. The numbers 0-24 have no pre-defined meaning, so you can use them in any way you like. And in fact, if you don't use folding, you can use all 32 markers in any way you like.

You can easily define a pixmap, image, or even a text character as the symbol to use for a marker. Just do something like:

    pixmap = QtGui.QPixmap('image.png')
    self.markerDefine(pixmap, self.CIRCLE_MARKER_NUM)

And the other variants work in a similar fashion.

PS:

You could have easily answered all the points (and more) in your question by consulting the excellent documentation available:

OTHER TIPS

You can find a very good explanation of markers on this website:

https://qscintilla.com/symbol-margin/

Here are some screenshots:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top