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 Update on Monday, May 27th 2025

QString with taglib

Scheduled Pinned Locked Moved Solved General and Desktop
qstringlisttaglib
6 Posts 3 Posters 3.0k Views
  • 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 28 Dec 2015, 11:50 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
    • R Offline
      R Offline
      Ratzz
      wrote on 28 Dec 2015, 12:03 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 28 Dec 2015, 16:27 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 28 Dec 2015, 17:09 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
          • M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 28 Dec 2015, 17:20 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 29 Dec 2015, 11:08 last edited by
              #6

              Thanks. It worked

              1 Reply Last reply
              0

              2/6

              28 Dec 2015, 12:03

              4 unread
              • Login

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