Everyone seems to have different views of where the challenge is here, but to me it's how, in a Qt QTextEdit widget, do you make some text sometimes invisible, *without* a new layer of text loading / unloading code that would be a huge pain to get right. So you text might be:
`Character formatting <http://qt-project.org/doc/qt-5/qtextcursor.html#setCharFormat>`_ and you want to see just "Character formatting" without quotes, in a different color. But, from Leo and the QTextEditors perspective, you want the text to just be what it is above, the long form. Attached is a screen shot of my proof of concept so far. The sharp eyed will notice a small dot before the 'S' in the second window. That's because Qt ignores font-size = 0 or letter spacing = 0. So that's what you get with font-size = 0.1 and letter spacing = 1 (percent). Code below. If we want them to be completely invisible we can make them the background color. If you cursor through this compressed text area the cursor seems to stall as it moves through the 70 plus almost hidden chars. But that's fine, because I think we'd want it to suddenly appear normal size if you put the cursor in it anyway, so the weird stalling wouldn't be an issue. The advantages of this is that everything else just works, copy paste, etc. etc. Up top I show an rst example, but this approach can apply to other syntaxes as well. All the time I have for now. Cheers -Terry import sys from PyQt4 import Qt app = Qt.QApplication(sys.argv) hello = Qt.QTextEdit() hello.setText("""First file:///home/tbrown/t/Proj/GLRI/Monitor/esriapp/doc/build/html/deploy.html Second One Third""") hello.show() doc = hello.document() curse = Qt.QTextCursor(doc) cfmt = Qt.QTextCharFormat() cfmt.setFontPointSize(23) while True: print curse.block().text() if 'Second' in curse.block().text(): curse.movePosition(curse.Right) curse.movePosition(curse.Right, curse.KeepAnchor, 74) cfmt = curse.charFormat() cfmt.setFontPointSize(0.1) cfmt.setFontLetterSpacing(1) curse.setCharFormat(cfmt) print 'SET' if not curse.movePosition(curse.NextBlock): break app.exec_() -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
