简体   繁体   中英

Pyqt4: Use of Marker Numbers in Qscintilla

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.:-
保证金设计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)

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:

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

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

Here are some screenshots:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM