Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QString with taglib
Forum Updated to NodeBB v4.3 + New Features

QString with taglib

Scheduled Pinned Locked Moved Solved General and Desktop
qstringlisttaglib
6 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shahriar25
    wrote on last edited by shahriar25
    #1

    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?

    1 Reply Last reply
    0
    • RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by Ratzz
      #2

      @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 ) );

      --Alles ist gut.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shahriar25
        wrote on last edited by
        #3

        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;

        1 Reply Last reply
        0
        • S Offline
          S Offline
          shahriar25
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            well
            TagLib::FileRef f( trackList->at(i).toStdString().data());
            It seems it wants char * so when u use QString you will have to convert.

            1 Reply Last reply
            1
            • S Offline
              S Offline
              shahriar25
              wrote on last edited by
              #6

              Thanks. It worked

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved