Search code examples
c++performanceqtqtextedit

QTextEdit takes an increasing amount of time to draw the text


I am using a QTextEdit, and I update the text (specifically setHTML) at a 1Hz rate.

Initially the setHtml method is fast (only a few ms); but after 12 hours of running, it takes 256 ms for setHTML to return, the data is a simple table with 5 columns and 10 rows.

This increase continues the longer the program runs.

Does anyone understand what is going on? And, more importantly, how can I make it stop?

Basically what I am doing is:

// get the start time
boost::posix_time::ptime start_time = boost::posix_time::microsec_clock::universal_time();

display->setHtml(text);

boost::posix_time::ptime end_time = boost::posix_time::microsec_clock::universal_time();

boost::posix_time::time_duration time_diff = end_time - start_time;

m_renderTimeDebug = double(time_diff.fractional_seconds() / 1000 );
std::cout << "DRAW TIME; took " << m_renderTimeDebug << " ms " << std::endl;

example here link


Solution

  • I found that this issue has been resolved in Qt 5.9.

    I am assuming this was found by the Qt guys and fixed. I have written a defect against Qt 5.8 QTBUG:61137