Hi Guys,
I would like to know if there is one solution to handle thousands of text blocks and set invisible to them at one time?
It is very slow if the program set visible as false/true as block by block.
Thank you in advance
Hi Guys,
I would like to know if there is one solution to handle thousands of text blocks and set invisible to them at one time?
It is very slow if the program set visible as false/true as block by block.
Thank you in advance
Do you mean QTextBlocks in a QTextDocument?
Yes, Chris.
I am not quite sure if we can control the attributes of text in the block with paint or draw event as it should be faster rather than setting the visible to true/false for thousands of blocks.
Thanks
Or is there any frame to warp the text block and we can simply add blocks into a container and set visibility to the container at one time?
Some options to explore to improve performance.
If the document is visible then each time you change the visibility of a block the widget will get an update event. So, try calling textEdit->setUpdatesEnabled(false), process the visibility of blocks, then textEdit->setUpdatesEnabled(true).
I am not sure if QTextDocument tracks block visibility with undo events, so you could try also try wrapping the changes with document->setUndoRedoEnabled().
Thanks Chris.
I will have a try and let you know then
Unfortunately, it does not work by seting setUpdateEnabled to true/false and it is still slow. the change history does not save the action for visibility setting.
I plan to use QTimer and set interval as 40 min sec then it should be resolved.
What does a timer have to do with the topic of this thread?
Hi Chris,
Because of there are 10k text blocks need to be set visibility as show/hidden, I would like to allow the program to process 1000 blocks every 40 min secs with QTimer until all of them are finalized, then it should be resolved as I expected but I have not modified yet.
I tried to use QTextLayout, QTextLine, QPlainTextDocumentLayout and QTextFrame, they are not working for this case.
Please correct me if I am wrong
Thanks
Bookmarks