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. How to use QMetaDataReaderControl to store available song metadata to QList<QStringList> while loading files from disk
Qt 6.11 is out! See what's new in the release blog

How to use QMetaDataReaderControl to store available song metadata to QList<QStringList> while loading files from disk

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 784 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.
  • C Offline
    C Offline
    cmoud94
    wrote on last edited by
    #1

    Hi,

    How can I store available song metadata while loadin song file from disk? I don't know how to exactly use this Class, while initializing QMetaDataReaderControl, I'm getting this error:
    @
    ../qPlayer/mainwindow.cpp: In constructor 'MainWindow::MainWindow(QWidget*)':
    ../qPlayer/mainwindow.cpp:16:53: error: cannot allocate an object of abstract type 'QMetaDataReaderControl'
    metadataReader = new QMetaDataReaderControl(this);
    ^
    In file included from /usr/include/qt5/QtMultimedia/QMetaDataReaderControl:1:0,
    from ../qPlayer/mainwindow.h:11,
    from ../qPlayer/mainwindow.cpp:1:
    /usr/include/qt5/QtMultimedia/qmetadatareadercontrol.h:58:27: note: because the following virtual functions are pure within 'QMetaDataReaderControl':
    class Q_MULTIMEDIA_EXPORT QMetaDataReaderControl : public QMediaControl
    ^
    /usr/include/qt5/QtMultimedia/qmetadatareadercontrol.h:64:18: note: virtual bool QMetaDataReaderControl::isMetaDataAvailable() const
    virtual bool isMetaDataAvailable() const = 0;
    ^
    /usr/include/qt5/QtMultimedia/qmetadatareadercontrol.h:66:22: note: virtual QVariant QMetaDataReaderControl::metaData(const QString&) const
    virtual QVariant metaData(const QString &key) const = 0;
    ^
    /usr/include/qt5/QtMultimedia/qmetadatareadercontrol.h:67:25: note: virtual QStringList QMetaDataReaderControl::availableMetaData() const
    virtual QStringList availableMetaData() const = 0;
    @

    Another question: Is there a better way of storing songs metadata while loading them from disk? Or is there another way of displaying the song title, author etc. in a QTableWidget while loading the songs?

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can't use this class like that. Like the error said it's an abstract class. You can query it using "QMediaService::requestControl":http://doc.qt.io/qt-5/qmediaservice.html#requestControl

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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