0

As a part of my application,I have a QListWidget with subtitle file names.My intention is to add a subtitles to the player by dragging items from the list widget to the player.I have sub classed the list widget and Mime data is defined as

        QStringList mimeTypes() const
        {
            QStringList typelists;
            typelists.append("text/uri-list");
            return typelists;
        }
        QMimeData * mimeData( const QList<QListWidgetItem *> items ) const
        {
            QMimeData *data = new QMimeData();
            QList< QUrl > urls;
            QUrl url;
            QString path=( tr("G:/videos/subs/%1").arg(items[0]->text()) );
            url=QUrl::fromLocalFile(path);
            qDebug() << url.path();
            urls.append( url );
            data->setUrls( urls );
            return data;
        }

It works perfectly for VLC player ,but MPC-HC throws "file not found" error.I have tried

mime type as text/plain --> Works for VLC

mime type as text/uri-list --> Works for VLC

Tried with file:////path as in this answer --> Didn't work

Is there any standard mimetype that all the media players are supposed to follow?

Community
  • 1
  • 1
feminkk
  • 1,135
  • 2
  • 14
  • 18

1 Answers1

0

The code works fine with the new version MPC-HC 1.7.7 (x64).Probably a bug in the earlier versions

feminkk
  • 1,135
  • 2
  • 14
  • 18