fix setWidgetText for progressBar

This commit is contained in:
Syping 2019-09-25 16:29:15 +02:00
parent 97c58b72bd
commit 3e4fda83ba

View file

@ -552,7 +552,9 @@ int LuaEngineGui::setWidgetText(lua_State *L_p)
((QPlainTextEdit*)pointer)->setPlainText(getVariant(L_p, 2).toString()); ((QPlainTextEdit*)pointer)->setPlainText(getVariant(L_p, 2).toString());
} }
else if (((QObject*)pointer)->inherits("QProgressBar")) { else if (((QObject*)pointer)->inherits("QProgressBar")) {
((QProgressBar*)pointer)->setFormat(getVariant(L_p, 2).toString()); QString progressBarText = getVariant(L_p, 2).toString();
((QProgressBar*)pointer)->setFormat(progressBarText);
((QProgressBar*)pointer)->setTextVisible(!progressBarText.isEmpty());
} }
else if (((QObject*)pointer)->inherits("QPushButton")) { else if (((QObject*)pointer)->inherits("QPushButton")) {
((QPushButton*)pointer)->setText(getVariant(L_p, 2).toString()); ((QPushButton*)pointer)->setText(getVariant(L_p, 2).toString());