Degree symbol display in a LabelControl #2532
-
So I have this code extract: QChar degree = (DEGREE_SYMBOL); //0x00b0
QString qstr = degree;
system.decimalDegreesToDMS(coords.y(), D, M, S);
std::stringstream latstream;
latstream << std::fixed << std::setw(2) << std::setfill('0') << (D < 0 ? -D : D) << qstr.toStdString()
<< std::fixed << std::setw(2) << std::setfill('0') << (M < 0 ? -M : M) << "'"
<< std::fixed << std::setw(2) << std::setprecision(0) << std::setfill('0') << (S < 0 ? -S : S)
<< (D < 0 ? "'' S" : "'' N");
std::string strText = "Latitude / Longitude\n" + latstream.str() + " " + lonstream.str() + "\nRange / Azimuth\n" + rngstream.str() + " " + azstream.str();
m_labelControl->setText(strText); But when it ouputs the degree symbol it looks like this... So what am I missing to get the degree symbol displayed correctly? In normal Qt widgets it displays fine without that 'A'. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Try simply outputting "\xb0" in your stream; this has worked for me in the past. (osgEarth also has a |
Beta Was this translation helpful? Give feedback.
-
Genius! |
Beta Was this translation helpful? Give feedback.
Try simply outputting "\xb0" in your stream; this has worked for me in the past.
(osgEarth also has a
LatLongFormatter
utility class that may or may not be useful to you.)