MW
27th July 2012, 17:12
Gd day,
I have read recently a topic named "QPlainTextEdit performance in Qt 4.7.0", as topic itself referred only to Qt 4.7.0 I started this one.
We can see that author wrote
...I've narrowed down by comenting stuff in my update method and it all comes to this
m_viewport->setPlainText(dataBuffer);
After that we can read that author himself "solved" the problem.
Happens the same on 4.7.2. So, compiled with 4.5.1 it's lighting fast, compiled with 4.7.0 and 4.7.2 it's amazingly slow
My case:
this->appendPlainText(finalLogContents);
Used as recommended in documentation with
setMaximumBlockCount = 80;
works the same as
this->setPlainText(finalLogContents);
Text in my QPlainTextEdit is refreshed every scroll made using either
QScrollBar or WheelEvent or PageDown - every time call to
setPlainText() consumes about 40% of 2.6 GHz CPU - it is way too much. Everytime variable named
finalLogContents consist of 80-100 lines depending on screen resolution.
I am thinking that maybe textChanged() SIGNAL is causing trouble - I will check it in a while with blockSignals().
Question:
Is there a method which use
char * instead of QString(I think it will be way faster cause I store all my data in
QByteArray
Should I revert to 4.5.1 or reimplement all crucial methods and create own fully customized TextEdit or maybe find another way using native QPlainTextEdit?
Thank you in advance, please post any even strange idea! :)
Edit 1:
Unfortunately textChanged SIGNAL is not causing my problem since it is not connected to any slot thus blocking it with QObject::blockSignals() gives nothing.
I have read recently a topic named "QPlainTextEdit performance in Qt 4.7.0", as topic itself referred only to Qt 4.7.0 I started this one.
We can see that author wrote
...I've narrowed down by comenting stuff in my update method and it all comes to this
m_viewport->setPlainText(dataBuffer);
After that we can read that author himself "solved" the problem.
Happens the same on 4.7.2. So, compiled with 4.5.1 it's lighting fast, compiled with 4.7.0 and 4.7.2 it's amazingly slow
My case:
this->appendPlainText(finalLogContents);
Used as recommended in documentation with
setMaximumBlockCount = 80;
works the same as
this->setPlainText(finalLogContents);
Text in my QPlainTextEdit is refreshed every scroll made using either
QScrollBar or WheelEvent or PageDown - every time call to
setPlainText() consumes about 40% of 2.6 GHz CPU - it is way too much. Everytime variable named
finalLogContents consist of 80-100 lines depending on screen resolution.
I am thinking that maybe textChanged() SIGNAL is causing trouble - I will check it in a while with blockSignals().
Question:
Is there a method which use
char * instead of QString(I think it will be way faster cause I store all my data in
QByteArray
Should I revert to 4.5.1 or reimplement all crucial methods and create own fully customized TextEdit or maybe find another way using native QPlainTextEdit?
Thank you in advance, please post any even strange idea! :)
Edit 1:
Unfortunately textChanged SIGNAL is not causing my problem since it is not connected to any slot thus blocking it with QObject::blockSignals() gives nothing.