Hi
I want to show my array's on a label, so i want to convert my char array to string for a label.
How may i do this?
Printable View
Hi
I want to show my array's on a label, so i want to convert my char array to string for a label.
How may i do this?
Just use QLabel::setText(const QString &) function with your array as the argument. QString class will make conversion for you.
For instance:
by the way,
why dont u use QString itself instead of the char[] ??
it is not working,:(
The last method is incorrect. You cannot just assign a pointer to char array to a pointer to QString. Why don't use the solution I've suggested earlier? There is no need to make things harder. If you need QString not only to set for a label but for other aims too, just instantiate QString with your array as a parameter: