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. Why i can read the metaData?
Qt 6.11 is out! See what's new in the release blog

Why i can read the metaData?

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

    my code is
    @
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QUrl>
    #include <QDebug>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    mediaObjcet = new Phonon::MediaObject;
    audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory,this);
    Phonon::createPath(mediaObjcet,audioOutput);
    QUrl url("X:/music/01-the_little_hands_of_asphalt-oslo-prs.mp3");
    mediaObjcet->setCurrentSource(url);
    playit();
    }

    void MainWindow::playit(){
    QMap<QString, QString> metaData = mediaObjcet->metaData();
    QString title = metaData.value("TITLE");
    qDebug()<<title;
    mediaObjcet->play();
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }
    @

    when i run this pro.the DeBug nothing.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      langziyang
      wrote on last edited by
      #2

      OK,now i find how can read it. but i am Chinese. so, when file is Chinese code.the metaData is messy code.even i used the
      QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF8"));
      QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF8"));
      QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF8"));
      how fix it

      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