c++ - Incorporate setText and setNum into a label in Qt? -


i have few simple lines of code of slot horizontal slider:

void newwindow::on_horizontalslider_valuechanged(int value) {     ui->label->setnum(value); } 

now, instead of label displaying number (such "11" or "42"), how make display "value: 11"?

i think have incorporate settext too, although don't know how that.

there's simple solution haven't found yet. help?

use qstring::number convert int qstring :

 ui->label->settext(qstring("value: ") + qstring::number(value)); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -