How to convert a qstring to hexadecimal
Solved
General and Desktop
-
I am developing an interface where it is necessary to add a value in hexadecimal by means of a QLineEdit, I already have that part including the saving of the data, but I do it in String, I want to know how to save it in herxadecimal, preserving the format, for example, if I write in the QLineEdit: A2 I want to save it in a variable in that same format but in hexadecimal. I don't know if I'm clear, if someone understands what I want to do, can they help me please
Somthing like this.
This is a QLineEdit
![alt text]
I want sonthig like this
-
Hi
Hex is a representation and not a basic true value so you cant really save it a variable as hex.
but you can convert a string between hex and decimal like thisQString str = "FF"; bool ok; int hex = str.toInt(&ok, 16); int dec = str.toInt(&ok, 10);