How to handle amount of text blocks?
-
Hi toyman,
you mean in QML? If so, why not using property binding triggered by a "global" property e.g. in your root QML file?
Let's say your root QML file is called "main.qml":
@
...
Item {
id: mainproperty bool globalTextVisibleFlag: true // or false, whatever you need here
...
}@And in the QMLs using your Text blocks:
@
...
Text {
...
visible: main.globalTextVisibleFlag
...
}
...@This allows to set all those text blocks' visibility by one single property change like:
@
function setAllTextVisibility(newVisibility) {
main.globalTextVisibleFlag = newVisibility
}
@Hope this helps
Regards, edmon -
Hi and welcome to devnet,
You might be interested by "this":http://qt-project.org/doc/qt-5/qwidget.html#updatesEnabled-prop
Hope it helps
-
Hi SGaist,
Thanks for your help.
I tried this before but it is still busy to process the visibility for each text block and it has around 10k blocks to be implemented.
I actually added the setUpdatesEnabled(false) for QPlainTextEdit object before the loop and inserted setUpdatedEnabled(true) after the loop.
It should stop updating and painting until the visibility has been set and then continue to paint and update for QPlainTextEdit. However, it is still very slow to process.
-
I found that the text frame (QTextFrame) can warp text blocks but it does not provide any functions in order to set visibility.
http://qt-project.org/doc/qt-5/qtextframe-members.html
It there anything can be done with layout or format to achieve this?