how to print variable unsigned char value in QLineEdit
-
-
QString value(name). // name is your unsigned char string
ui->lineEdit_1.setText(value). -
Thanks @dheerendra,
In my case i dont't know the string which unsigned char hold because unsigned char get it from function and i want to print in lineEdit to see that so how can i do it? -
@shree_121 you can simply pass
setText
the pointer to the char array, as long as it's 0 terminated it will implicitly convert it to a string.this for example works fine:
ui->lineEdit_1->setText(Q_FUNC_INFO);
-
As @J-Hilk already suggested try directly. If not give your complete sample. We will help you. Your code does not give the what you are getting.
-
@shree_121
So it would be
ui->lineEdit->setText(stuGtbInfo.strubmodel);if strubmodel is the char *
do you want all 3 char* into one string ?
to display?like
QString model(stuGtbInfo.strubmodel);
QString version(stuGtbInfo.strubversion);
QString rev(stuGtbInfo.strubrevision);ui->lineEdit->setText( model+"|"+version+"|"+rev );
-
@shree_121
That it cant make a QString from stuGtbInfo.strubmodel.
Its unsigned char which is a bit odd for a string.
try
ui->lineEdit->setText(reinterpret_cast<const char *>((stuGtbInfo.strubmodel));