Am I interpreting this code correctly?

Here is the line I am trying to read:

 
  return QString(static_cast<QChar>(QLatin1Char(value)));


I believe the line is casting 'value' into QLatinChar and then casting that into QChar which is then being casted into a QString, right? The odd part, the 'value' going in is already a char. Which is why I am concerned that I am not interpreting this line correctly.
Technically, it's constructing a QLatin1Char using a 1-arg constructor that takes in whatever type "value" is. Otherwise, yes that's correct.

The odd part, the 'value' going in is already a char.

Correct, if 'value' is already a char (1 byte), you still won't be able to fit a 2-byte character. Also, QLatin1Chars are only 1-byte as well.

What helios said in his latest post in the other thread should work for you.
Last edited on
return the value (type unclear)
of the result of the Qstring function

when it is called with the result
of QLatin1Char on parameter value
when that result from QLatin1Char is recast from whatever it was to a Qchar type.

or more clearly
call QLatin1Char(value)
convert that to Qchar
call QString on the Qchar
and return that final result.
Last edited on
@Ganado Thanks!
Don't post multiple threads about the same topic/problem. It makes it less likely that people can answer usefully because it fragments the discussion.
Topic archived. No new replies allowed.