summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/multimedia/videographicsitem/videoplayer.cpp15
-rw-r--r--examples/multimedia/videowidget/videoplayer.cpp15
2 files changed, 28 insertions, 2 deletions
diff --git a/examples/multimedia/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp
index 281cd6e..f98f542 100644
--- a/examples/multimedia/videographicsitem/videoplayer.cpp
+++ b/examples/multimedia/videographicsitem/videoplayer.cpp
@@ -115,7 +115,20 @@ VideoPlayer::~VideoPlayer()
void VideoPlayer::openFile()
{
- QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"));
+ QStringList supportedFormats;
+ foreach (QString fmt, QMovie::supportedFormats())
+ supportedFormats << fmt;
+ foreach (QString fmt, QImageReader::supportedImageFormats())
+ supportedFormats << fmt;
+
+ QString filter = "Images (";
+ foreach ( QString fmt, supportedFormats) {
+ filter.append(QString("*.%1 ").arg(fmt));
+ }
+ filter.append(")");
+
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"),
+ QDir::homePath(), filter);
if (!fileName.isEmpty()) {
videoItem->stop();
diff --git a/examples/multimedia/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp
index 87a2621..ad12069 100644
--- a/examples/multimedia/videowidget/videoplayer.cpp
+++ b/examples/multimedia/videowidget/videoplayer.cpp
@@ -96,7 +96,20 @@ VideoPlayer::~VideoPlayer()
void VideoPlayer::openFile()
{
- QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"));
+ QStringList supportedFormats;
+ foreach (QString fmt, QMovie::supportedFormats())
+ supportedFormats << fmt;
+ foreach (QString fmt, QImageReader::supportedImageFormats())
+ supportedFormats << fmt;
+
+ QString filter = "Images (";
+ foreach ( QString fmt, supportedFormats) {
+ filter.append(QString("*.%1 ").arg(fmt));
+ }
+ filter.append(")");
+
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"),
+ QDir::homePath(), filter);
if (!fileName.isEmpty()) {
surface->stop();