examples/QtQuick/qtvideoplayer/myitem.cpp

00001 #include "myitem.h"
00002 
00003 #include <QtDeclarative/qdeclarative.h>
00004 #include <QtGui>
00005 
00006 MyItem::MyItem(QDeclarativeItem *parent):
00007         QDeclarativeItem(parent)
00008 {
00009     // By default, QDeclarativeItem does not draw anything. If you subclass
00010     // QDeclarativeItem to create a visual item, you will need to uncomment the
00011     // following line:
00012 
00013     // setFlag(ItemHasNoContents, false);
00014 }
00015 
00016 MyItem::~MyItem()
00017 {
00018 
00019 }
00020 
00021 // Open a file dialog,to select the music files.
00022 void MyItem::openDialog()
00023 {
00024     QWidget *myDialog = new QWidget();
00025 
00026     // put a filter as last argument.
00027     QString fileName = QFileDialog::getOpenFileName(myDialog, tr("Open Video file"),
00028             QDir::homePath(),tr("Video Files (*.avi *.mp4 *.3gp)"));
00029 
00030 
00031     if (!fileName.isEmpty()) {
00032         QUrl url;
00033         url = QUrl::fromLocalFile(fileName);
00034         emit fileSelected(url);
00035     }
00036 }
00037 

Generated by  doxygen 1.6.2