How to set visibility for text blocks in QTextEdit?

I tried to hide the text block in QTextEdit, but it does not work:

block = textedit.document().begin()
block.setVisible(False)

This code works fine for QPlainTextEdit, but not for QTextEdit. In the documentation, I did not find a mention of how it should work for QTextEdit, just following it:

void QTextBlock :: setVisible (bool visible) Sets the visibility of the block to visible.

This feature was introduced in Qt 4.4.

See also isVisible ().

How can I hide a block in QTextEdit?

Thank you in advance

+1
source share
1 answer

I have confirmed the behavior described by you. In addition, I confirmed that in the code you specified following the setVisible method, the visibility of the block is indeed False.

, , , : QPlainTextEdit QTextEdit. QScrollableArea, , QTextEdit . , QPlainTextEdit, QPlainTextLayout, QTextEdit - , .

... , , . , , QTextEdit, Python .

self.paragraphs = ["First paragraph","Second Paragraph","Third Paragraph",]
self.display_text = '\n'.join(self.paragraphs[1:])
self.textedit.setText(self.display_text)
+1

All Articles