I have to compare the text of a buton with a const , say for example "Set Homograph"...qstrcmp is showing error:
if(qstrcmp(localCalibrateControlsObj->setHomographyButton->text(),"Set Homography")==0)
ERROR:cannot convert QString to const cha *....
I have to compare the text of a buton with a const , say for example "Set Homograph"...qstrcmp is showing error:
if(qstrcmp(localCalibrateControlsObj->setHomographyButton->text(),"Set Homography")==0)
ERROR:cannot convert QString to const cha *....
You can use QString(const char* str) to convert it to a QString
while QString has implicit constructor you can compare them with == operator
Qt Code:
if ( localCalibrateControlsObj->setHomographyButton->text() == "Set Homography" ) ...To copy to clipboard, switch view to plain text mode
and if you want to compare with qstrcmp you should get a const char pointer to QString data like this
Qt Code:
if ( qstrcmp( localCalibrateControlsObj->setHomographyButton->text().toAscii().constData(),"Set Homography")==0) ...To copy to clipboard, switch view to plain text mode
qt_user (10th August 2010)
thanx............thanx a lot
Bookmarks