I am trying to convert a Qstring to UTF8 for a mysql query. I am getting the following error.
1>.\thewge.cpp(54) : error C2039: 'utf8' : is not a member of 'QString'
1> c:\qt\4.6.2\include\qtcore\../../src/corelib/tools/qstring.h(91) : see declaration of 'QString'
1>.\thewge.cpp(55) : error C2039: 'utf8' : is not a member of 'QString'
1> c:\qt\4.6.2\include\qtcore\../../src/corelib/tools/qstring.h(91) : see declaration of 'QString'
QString Qstr1
= ui.
usrLineEdit->text
();
QString Qstr2
= ui.
pwdLineEdit->text
();
char *acsUserName = Qstr1.utf8();
char *acsPassword = Qstr2.utf8();
QString Qstr1 = ui.usrLineEdit->text();
QString Qstr2 = ui.pwdLineEdit->text();
char *acsUserName = Qstr1.utf8();
char *acsPassword = Qstr2.utf8();
To copy to clipboard, switch view to plain text mode
I also tried this.
QString Qstr1
= ui.
usrLineEdit->text
();
QString Qstr2
= ui.
pwdLineEdit->text
();
char *acsUserName = Qstr1.toUtf8();
char *acsPassword = Qstr2.toUtf8();
QString Qstr1 = ui.usrLineEdit->text();
QString Qstr2 = ui.pwdLineEdit->text();
char *acsUserName = Qstr1.toUtf8();
char *acsPassword = Qstr2.toUtf8();
To copy to clipboard, switch view to plain text mode
and got these errors:
1>.\thewge.cpp(53) : error C2440: 'initializing' : cannot convert from 'QByteArray' to 'char *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\thewge.cpp(54) : error C2440: 'initializing' : cannot convert from 'QByteArray' to 'char *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Bookmarks