Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTextEdit text change
ultrablox last edited by
I am trying to make customized text edit with some different block styles. The QTextDocument does not use frames - it is an array of blocks. The idea is, that each block has its user data, which defines type of block, and points to the item in linear array of my array of my_block_t.
When I change a block text - I want to change corresponding my_block_t. When I delete a text block - I want to delete corresponding my_block_t. It is needed for building some complex structure over this array.
I expected some clever signals from QTextEdit - like blockAdded(QTextBlock), blockRemoved(QTextBlock) and blockChanged(QTextBlock, QString old_data), and they could solved my problem. But I got only textChanged() and cursorPositionChanged(), and scanning all the document and rebuilding my whole structure after each textChanged is too expensive. How could I get needed events? At least how can I know delta in textChanged()?
Hi and welcome to devnet,
Hope it helps