How to draw line between folded blocks in QPlainTextEdit?
Asked Answered
T

0

0

I have a struggle and I even don't know is it possible in QPlainTextEdit. Have no idea how to draw a line between to folded blocks in QPlainTextEdit :

import sys
from PySide.QtCore import *
from PySide.QtGui import *

app = QApplication(sys.argv)

textEdit = QPlainTextEdit()
textEdit.setViewportMargins( 50,0,0,0 )

textEdit.setPlainText( 
'''There is a house in New Orleans
They call the Rising Sun
And it's been the ruin of many a poor boy
And God, I know I'm one'
''')

for n in [1,2] :
    textEdit.document().findBlockByNumber(n).setVisible( False )

textEdit.setGeometry( 600, 600, 400, 250 )
textEdit.show()
sys.exit(app.exec_())

....now two blocks are folded, but can't draw the line between two visible. I would appreciate any help. Thanks.

Tetra answered 11/2, 2016 at 20:11 Comment(4)
I don't know if QPlainTextEdit allows so much customizing as required. Better to use QTextEdit for advanced formatting, no ?Cavein
you could insert an <hr> between lines, but you're on your own to handle the effective text contentCavein
textCursor().insertHtml("<hr>") not working ? - note I'm not using Python with Qt, but C++Cavein
Nope! But most of other tags work.Tetra

© 2022 - 2024 — McMap. All rights reserved.