<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[how to save and load playlist in qt ?]]></title><description><![CDATA[<p dir="auto">hello , i am new to qt and i am making a mp3 player but i am getting a problem in saving and loading playlist . can anyone please tell a easy code to save and load playlist in qt.</p>
]]></description><link>https://forum.qt.io/topic/60443/how-to-save-and-load-playlist-in-qt</link><generator>RSS for Node</generator><lastBuildDate>Fri, 14 Aug 2026 06:54:24 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/60443.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 07 Nov 2015 19:10:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to how to save and load playlist in qt ? on Sun, 08 Nov 2015 10:50:03 GMT]]></title><description><![CDATA[<p dir="auto">#include &lt;QMediaPlaylist&gt;<br />
#include &lt;QFileDialog&gt;<br />
#include &lt;QDebug&gt;<br />
void MainWindow::on_pushButton_released()<br />
{<br />
QMediaPlaylist* playlist = new QMediaPlaylist;<br />
playlist-&gt;addMedia(QUrl("<a href="http://example.com/movie1.mp4" target="_blank" rel="noopener noreferrer nofollow ugc">http://example.com/movie1.mp4</a>"));<br />
playlist-&gt;addMedia(QUrl("<a href="http://example.com/movie2.mp4" target="_blank" rel="noopener noreferrer nofollow ugc">http://example.com/movie2.mp4</a>"));<br />
playlist-&gt;addMedia(QUrl("<a href="http://example.com/movie3.mp4" target="_blank" rel="noopener noreferrer nofollow ugc">http://example.com/movie3.mp4</a>"));<br />
QString fn=QFileDialog::getSaveFileName(this,"Save file",QDir::currentPath(),<br />
"Text files (<em>.txt);;All files (</em>.*)");<br />
qDebug() &lt;&lt; playlist-&gt;save(QUrl::fromLocalFile(fn),"m3u");<br />
delete QMediaPlaylist;<br />
}</p>
]]></description><link>https://forum.qt.io/post/297140</link><guid isPermaLink="true">https://forum.qt.io/post/297140</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Sun, 08 Nov 2015 10:50:03 GMT</pubDate></item><item><title><![CDATA[Reply to how to save and load playlist in qt ? on Sat, 07 Nov 2015 19:37:04 GMT]]></title><description><![CDATA[<p dir="auto">Open file containing playlist with QFile and then read/write it with QTextStream or QDataStream. Smth like this:</p>
<pre><code>// Reading
QFile f("list.pl");
if (f.open(QFile::ReadOnly)) {
  QDataStream s(&amp;f);
  QString song;
  while (!s.atEnd()) { s &gt;&gt; song; }
}
</code></pre>
<p dir="auto">You can extend QDataStream for reading/writing your custom data (<a href="http://doc.qt.io/qt-5/qdatastream.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qdatastream.html</a>)</p>
]]></description><link>https://forum.qt.io/post/297084</link><guid isPermaLink="true">https://forum.qt.io/post/297084</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Sat, 07 Nov 2015 19:37:04 GMT</pubDate></item></channel></rss>