How to handle amount of text blocks?
-
wrote on 30 Jan 2014, 08:34 last edited by
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 sets visiblility to false/true as block by block.
Thank you in advance
-
wrote on 30 Jan 2014, 09:40 last edited by
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 -
wrote on 30 Jan 2014, 09:56 last edited by
Thanks, edmon.
It is C++ application not QML.
-
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
-
wrote on 30 Jan 2014, 13:56 last edited by
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.
-
wrote on 30 Jan 2014, 13:58 last edited by
I may have some wrong steps and please correct me :)
-
wrote on 30 Jan 2014, 14:27 last edited by
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?
-
wrote on 4 Feb 2014, 14:24 last edited by
I plan to use QTimer and set interval as 40 min sec then it should be resolved.
7/8