Convert QString to char
-
How do I convert a QString to a char. When using latcardinalDirection = latlist[3].QLatin1Char(); the compiler says that QString does not have a member called QLatin1Char(). May you please assist?
@
char latcardinalDirection,longcardinalDirection ;
QString latitudestring = QInputDialog::getText(0, "Latitude"," Degrees Minutes Seconds Cardinal Direction: ",QLineEdit::Normal,"",&ok,0);QStringList latlist; latlist = latitudestring.split(" "); int latdegrees = latlist[0].toInt(); int latminutes = latlist[1].toInt(); int latseconds = latlist[2].toInt(); latcardinalDirection = latlist[3].QLatin1Char();@
-
Normally the compiler is right saying a member is not existing if it is not.
If you are sure that the string is set correctly you can use something like
@
latlist[3].c_str()[0]
@(Did not check const correctness on this)
-
Hi,
QLatin1Char() is not a method it's a constructor (invalid in this case)
You can use e.g.
@latlist[3][0].toAscii();@