I am using Qt 5.7 for a GUI application with a QProgressBar. I suspect that there might be a memory leak since memory usage increases during runtime for about 50MB/s. I could narrow down the problem to one line of code.
QProgressBar *pbarQuality;
...
int curQuality = data.getQuality();
if (curQuality < 0) {
curQuality = 0;
qWarning("Value set to 0. ");
}
if (curQuality > 100) {
curQuality = 100;
qWarning("Value set to 100. ");
}
ui.pbarQuality->setValue(curQuality); //The memory problem doesn't occur when this single line is commented out
The value of the QProgressBar(pbarQuality) is only for displaying. It isn't used anywhere else.
I find this a very strange behaviour. Am I missing something?
Here is the auto generated code by the Qt Designer:
pbarQuality = new QProgressBar(frame_5);
pbarQuality->setObjectName(QStringLiteral("pbarQuality"));
pbarQuality->setGeometry(QRect(10, 50, 130, 23));
pbarQuality->setValue(24);