How to speed up performance of QTextEdit?
-
I am implementing a panel which use QTextEdit to log message. I have a issue, when a long message is being printed on this panel, the results appear much faster if the panel is shorter than if it is taller(just resize it between larger and smaller).
How to speed up performance the right way? -
I am implementing a panel which use QTextEdit to log message. I have a issue, when a long message is being printed on this panel, the results appear much faster if the panel is shorter than if it is taller(just resize it between larger and smaller).
How to speed up performance the right way?@John-Vu
this is due to the text layouting engine, which has to relayout on changes.
Do you depend on QTextEdit?
If no you could also use a QListView and add the log lines as rows to a model and let the item view widget layout it's visible items.
This should perform better than the QTextEdit in this case. -
@John-Vu
this is due to the text layouting engine, which has to relayout on changes.
Do you depend on QTextEdit?
If no you could also use a QListView and add the log lines as rows to a model and let the item view widget layout it's visible items.
This should perform better than the QTextEdit in this case.@raven-worx Thanks
I depend on QTextEdit because there are a lot of objects use this panel. If I don't use QTextEdit, I have to change a lot of things.
Can I use QListView and add the QTextEdit as rows? And do I have to add a model in this case? -
@raven-worx Thanks
I depend on QTextEdit because there are a lot of objects use this panel. If I don't use QTextEdit, I have to change a lot of things.
Can I use QListView and add the QTextEdit as rows? And do I have to add a model in this case?@John-Vu said:
I depend on QTextEdit because there are a lot of objects use this panel. If I don't use QTextEdit, I have to change a lot of things.
This isn't really dependent than, but lazy ;)
I meant dependent by any of QTextEdit features.
Probably you just have a bad design? Why are do many parts in your application depend on a widget, but not just simply interchange the text directly, or at least a light-weight data class/struct.Can I use QListView and add the QTextEdit as rows?
yes you could. But from a certain point onwards you performance will probably be even worse after all.
And do I have to add a model in this case?
A model is always involved when using item vie widgets.
-
@John-Vu said:
I depend on QTextEdit because there are a lot of objects use this panel. If I don't use QTextEdit, I have to change a lot of things.
This isn't really dependent than, but lazy ;)
I meant dependent by any of QTextEdit features.
Probably you just have a bad design? Why are do many parts in your application depend on a widget, but not just simply interchange the text directly, or at least a light-weight data class/struct.Can I use QListView and add the QTextEdit as rows?
yes you could. But from a certain point onwards you performance will probably be even worse after all.
And do I have to add a model in this case?
A model is always involved when using item vie widgets.
@raven-worx I am implementing a terminal with QTextEdit in qt4.7.4 for a long time. I need some features of QTextEdit as: change text color, hyperlink, key & mouse events, call back previous command. Are these features available in QListView or am I able to implement them with QListView?
And is QStringListModel compatible in this case?