QString with taglib
-
Hi
I have Problem. I'm using taglib in my project and I have a QString containing the file path but I don't know how to use it in TagLib::FileRef.
TagLib::FileRef uses TString so I tried this:TagLib::FileRef f( QStringToTString ( trackList->at( i ) ).toCString( true ) );
but I get this error:
error: 'const class QString' has no member named 'utf8'
TagLib::FileRef f(QStringToTString(trackList->at(i)).toCString(true));
---------------------------------------------^
What am I doing wrong? -
@shahriar25
May be this helps you http://stackoverflow.com/questions/5642251/taglib-how-to-handle-utf-8-encoded-file-paths
TagLib::FileRef f( QStringToTString ( trackList->at( i ).constData() ).toCString( true ) ); -
Hi
None of the pages helped and when I run
TagLib::FileRef f( QStringToTString ( trackList->at( i ).constData() ).toCString( true ) );This happenes:
error: request for member 'utf8' in '(& trackList->QStringList::<anonymous>.QList<T>::at<QString>(i))->QString::constData()', which is of pointer type 'const QChar*' (maybe you meant to use '->' ?)and when I use -> this error happenes:
error: base operand of '->' has non-pointer type 'const QString'
TagLib::FileRef f(QStringToTString(trackList->at(i)->constData()).toCString(true));I want to read the tags from the paths I have in a QListString:
QStringList *trackList = new QStringList; -
Hi guys.
I was finally able to do it this way:QString tempQString = trackList->at(i);
std::string tempString = tempQString.toStdString();
TagLib::FileRef f(tempString.data());But is there an easier way?
-
well
TagLib::FileRef f( trackList->at(i).toStdString().data());
It seems it wants char * so when u use QString you will have to convert. -
Thanks. It worked