本文整理汇总了C++中durationChanged函数的典型用法代码示例。如果您正苦于以下问题:C++ durationChanged函数的具体用法?C++ durationChanged怎么用?C++ durationChanged使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了durationChanged函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mSession
QXAMediaPlayerControl::QXAMediaPlayerControl(QXAPlaySession *session, QObject *parent)
:QMediaPlayerControl(parent), mSession(session)
{
QT_TRACE_FUNCTION_ENTRY;
connect(mSession, SIGNAL(mediaChanged(const QMediaContent &)),
this, SIGNAL(mediaChanged(const QMediaContent& )));
connect(mSession, SIGNAL(durationChanged(qint64)),
this, SIGNAL(durationChanged(qint64)));
connect(mSession, SIGNAL(positionChanged(qint64)),
this, SIGNAL(positionChanged(qint64)));
connect(mSession, SIGNAL(stateChanged(QMediaPlayer::State)),
this, SIGNAL(stateChanged(QMediaPlayer::State)));
connect(mSession, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
this, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
connect(mSession, SIGNAL(volumeChanged(int)),
this, SIGNAL(volumeChanged(int)));
connect(mSession, SIGNAL(mutedChanged(bool)),
this, SIGNAL(mutedChanged(bool)));
connect(mSession, SIGNAL(audioAvailableChanged(bool)),
this, SIGNAL(audioAvailableChanged(bool)));
connect(mSession, SIGNAL(videoAvailableChanged(bool)),
this, SIGNAL(videoAvailableChanged(bool)));
connect(mSession,SIGNAL(bufferStatusChanged(int)),
this, SIGNAL(bufferStatusChanged(int)));
connect(mSession, SIGNAL(seekableChanged(bool)),
this, SIGNAL(seekableChanged(bool)));
connect(mSession, SIGNAL(availablePlaybackRangesChanged(const QMediaTimeRange&)),
this, SIGNAL(availablePlaybackRangesChanged(const QMediaTimeRange&)));
connect(mSession, SIGNAL(playbackRateChanged(qreal)),
this, SIGNAL(playbackRateChanged(qreal)));
connect(mSession, SIGNAL(error(int, const QString &)),
this, SIGNAL(error(int, const QString &)));
QT_TRACE_FUNCTION_EXIT;
}
示例2: QWidget
Player::Player(QWidget *parent)
: QWidget(parent)
, videoWidget(0)
, coverLabel(0)
, slider(0)
, audioEndpointSelector(0)
#ifdef Q_OS_SYMBIAN
// , mediaKeysObserver(0)
, playlistDialog(0)
, toggleAspectRatio(0)
, showYoutubeDialog(0)
, youtubeDialog(0)
#else
, colorDialog(0)
#endif
{
player = new QMediaPlayer(this);
// owned by PlaylistModel
playlist = new QMediaPlaylist();
player->setPlaylist(playlist);
connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64)));
connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64)));
connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged()));
connect(playlist, SIGNAL(currentIndexChanged(int)), SLOT(playlistPositionChanged(int)));
connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
this, SLOT(statusChanged(QMediaPlayer::MediaStatus)));
connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int)));
connect(player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(displayErrorMessage()));
videoWidget = new VideoWidget(this);
player->setVideoOutput(videoWidget);
playlistModel = new PlaylistModel(this);
playlistModel->setPlaylist(playlist);
playlistView = new QListView(this);
playlistView->setModel(playlistModel);
playlistView->setCurrentIndex(playlistModel->index(playlist->currentIndex(), 0));
connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex)));
slider = new QSlider(Qt::Horizontal, this);
slider->setRange(0, player->duration() / 1000);
connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int)));
QMediaService *service = player->service();
if (service) {
QMediaControl *control = service->requestControl(QAudioEndpointSelector_iid);
if (control) {
audioEndpointSelector = qobject_cast<QAudioEndpointSelector*>(control);
if (audioEndpointSelector) {
connect(audioEndpointSelector, SIGNAL(activeEndpointChanged(const QString&)),
this, SLOT(handleAudioOutputChangedSignal(const QString&)));
} else {
service->releaseControl(control);
}
}
}
示例3: QMainWindow
ImageProcessing::ImageProcessing(QWidget *parent) : QMainWindow(parent) {
iImageIndex = 0;
m_NetTimeout = 0;
m_ImageTimeout = 0;
lbImage = new QLabel(this);
bTurnOff = false;
m_notRunning = true;
setWindowState(Qt::WindowFullScreen);
player = new QMediaPlayer(this);
playlist = new QMediaPlaylist();
player->setPlaylist(playlist);
m_contentList = new FileDownload(this);
m_imageFile = new FileDownload(this);
pNextImage = new QTimer();
connect(pNextImage, SIGNAL(timeout()), this, SLOT(timeout()));
connect(m_contentList, SIGNAL(downloaded()), this, SLOT(contentListDownloadComplete()));
connect(m_contentList, SIGNAL(downloadError(QNetworkReply::NetworkError)), this, SLOT(fileDownloadError(QNetworkReply::NetworkError)));
connect(m_imageFile, SIGNAL(downloaded()), this, SLOT(fileDownloadComplete()));
connect(m_imageFile, SIGNAL(downloadError(QNetworkReply::NetworkError)), this, SLOT(fileDownloadError(QNetworkReply::NetworkError)));
connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
connect(player, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged()));
connect(player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(displayErrorMessage()));
connect(this, SIGNAL(fileDownloadsComplete()), this, SLOT(unlockShowEvent()));
videoWidget = new QVideoWidget(this);
player->setVideoOutput(videoWidget);
videoWidget->hide();
}
示例4: setAcceptDrops
void QSWindow::preload(){
//file control buttons and shortcuts
setAcceptDrops(true);
ui->tabWidget->setAcceptDrops(true);
connect(ui->actionOpen_File, SIGNAL(triggered()), SLOT(openFile()));
ui->actionOpen_File->setShortcut(QKeySequence::Open);
connect(ui->actionSave_File, SIGNAL(triggered()), SLOT(saveFile()));
ui->actionSave_File->setShortcut(QKeySequence::Save);
connect(ui->actionSave_File_as, SIGNAL(triggered()), SLOT(saveFileAs()));
ui->actionSave_File_as->setShortcut(QKeySequence::SaveAs);
connect(ui->actionClose, SIGNAL(triggered()), SLOT(closeFile()));
ui->actionClose->setShortcut(QKeySequence::Close);
connect(ui->actionPreset, SIGNAL(triggered()), SLOT(changePreset()));
connect(ui->actionDisplay_Keyboard, SIGNAL(triggered()), SLOT(displayKeyBoard()));
ui->actionDisplay_Keyboard->setShortcut(QKeySequence("ctrl+K"));
connect(ui->actionDisplay_specturm,SIGNAL(triggered()), SLOT(displaySpectrum()));
connect(ui->actionScore_to_wav, SIGNAL(triggered()), SLOT(scoreToWav()));
connect(ui->actionWav_to_score, SIGNAL(triggered()), SLOT(wavToScore()));
connect(ui->menuOpened, SIGNAL(triggered(QAction*)), SLOT(switchScene(QAction*)));
connect(this,SIGNAL(addFromLameSignal(QString)),this, SLOT(addFromLame(QString)), Qt::QueuedConnection);
//music state management
connect(mediaPlayer, SIGNAL(positionChanged(qint64)),
this,SLOT(positionChanged(qint64)),Qt::QueuedConnection);
connect(mediaPlayer, SIGNAL(durationChanged(qint64)),
this, SLOT(durationChanged(qint64)),Qt::QueuedConnection);
connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this,
SLOT(mediaStateChanged(QMediaPlayer::State)),Qt::QueuedConnection);
connect(positionSlider, SIGNAL(sliderReleased()), this, SLOT(setPosition()),Qt::QueuedConnection);
connect(playButton, SIGNAL(clicked()), this, SLOT(musicPlay()),Qt::QueuedConnection);
connect(recorder->recordButton, SIGNAL(clicked()), this, SLOT(record()));
}
示例5: QWidget
VideoPlayer::VideoPlayer(QWidget *parent)
: QWidget(parent)
, mediaPlayer(0, QMediaPlayer::VideoSurface)
, videoItem(0)
, playButton(0)
, positionSlider(0)
{
videoItem = new QGraphicsVideoItem;
videoItem->setSize(QSizeF(640, 480));
QGraphicsScene *scene = new QGraphicsScene(this);
QGraphicsView *graphicsView = new QGraphicsView(scene);
scene->addItem(videoItem);
QSlider *rotateSlider = new QSlider(Qt::Horizontal);
rotateSlider->setRange(-180, 180);
rotateSlider->setValue(0);
connect(rotateSlider, SIGNAL(valueChanged(int)),
this, SLOT(rotateVideo(int)));
QAbstractButton *openButton = new QPushButton(tr("Open..."));
connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
playButton = new QPushButton;
playButton->setEnabled(false);
playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
connect(playButton, SIGNAL(clicked()),
this, SLOT(play()));
positionSlider = new QSlider(Qt::Horizontal);
positionSlider->setRange(0, 0);
connect(positionSlider, SIGNAL(sliderMoved(int)),
this, SLOT(setPosition(int)));
QBoxLayout *controlLayout = new QHBoxLayout;
controlLayout->setMargin(0);
controlLayout->addWidget(openButton);
controlLayout->addWidget(playButton);
controlLayout->addWidget(positionSlider);
QBoxLayout *layout = new QVBoxLayout;
layout->addWidget(graphicsView);
layout->addWidget(rotateSlider);
layout->addLayout(controlLayout);
setLayout(layout);
mediaPlayer.setVideoOutput(videoItem);
connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
this, SLOT(mediaStateChanged(QMediaPlayer::State)));
connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
}
示例6: QWidget
VideoPlayer::VideoPlayer(QWidget *parent)
: QWidget(parent)
, mediaPlayer(0, QMediaPlayer::VideoSurface)
, playButton(0)
, positionSlider(0)
, errorLabel(0)
{
QVideoWidget *videoWidget = new QVideoWidget;
QAbstractButton *openButton = new QPushButton(tr("Open..."));
connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
playButton = new QPushButton;
playButton->setEnabled(false);
playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
connect(playButton, SIGNAL(clicked()),
this, SLOT(play()));
positionSlider = new QSlider(Qt::Horizontal);
positionSlider->setRange(0, 0);
connect(positionSlider, SIGNAL(sliderMoved(int)),
this, SLOT(setPosition(int)));
errorLabel = new QLabel;
errorLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
QBoxLayout *controlLayout = new QHBoxLayout;
controlLayout->setMargin(0);
controlLayout->addWidget(openButton);
controlLayout->addWidget(playButton);
controlLayout->addWidget(positionSlider);
QBoxLayout *layout = new QVBoxLayout;
layout->addWidget(videoWidget);
layout->addLayout(controlLayout);
layout->addWidget(errorLabel);
setLayout(layout);
mediaPlayer.setVideoOutput(videoWidget);
connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
this, SLOT(mediaStateChanged(QMediaPlayer::State)));
connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
connect(&mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(handleError()));
QFileInfo info("C:\\Users\\MichaU\\Desktop\\ResonanceP1.mp4");
QMediaPlaylist *lista = new QMediaPlaylist;
lista->addMedia(QUrl::fromLocalFile(info.absoluteFilePath()));
mediaPlayer.setPlaylist(lista);
mediaPlayer.play();
connect(lista,SIGNAL(currentIndexChanged(int)),this,SLOT(ChangePlaylist()));
}
示例7: connect
void SMActionVideoNative::connectPlayer()
{
connect(mediaPlayer, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64)));
connect(mediaPlayer, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64)));
connect(mediaPlayer,
SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
}
示例8: connect
MyPlayer::MyPlayer()
{
playerState = NOMUSIC;
connect(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(playNext(QMediaPlayer::MediaStatus)));
connect(&player, SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged(qint64)));
connect(&player, SIGNAL(durationChanged(qint64)), this, SLOT(musicChanged()));
connect(&player, SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged(qint64)));
connect(this, SIGNAL(playerStateChanged(int)), this, SLOT(stateChanged(int)));
}
示例9: m_session
QXAMediaRecoderControl::QXAMediaRecoderControl(QXARecordSession *session, QObject *parent)
:QMediaRecorderControl(parent), m_session(session)
{
connect(m_session, SIGNAL(stateChanged(QMediaRecorder::State)),
this, SIGNAL(stateChanged(QMediaRecorder::State)));
connect(m_session, SIGNAL(error(int,QString)),
this,SIGNAL(error(int,QString)));
connect(m_session, SIGNAL(durationChanged(qint64)),
this, SIGNAL(durationChanged(qint64)));
}
示例10: QMediaRecorderControl
BbCameraMediaRecorderControl::BbCameraMediaRecorderControl(BbCameraSession *session, QObject *parent)
: QMediaRecorderControl(parent)
, m_session(session)
{
connect(m_session, SIGNAL(videoStateChanged(QMediaRecorder::State)), this, SIGNAL(stateChanged(QMediaRecorder::State)));
connect(m_session, SIGNAL(videoStatusChanged(QMediaRecorder::Status)), this, SIGNAL(statusChanged(QMediaRecorder::Status)));
connect(m_session, SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged(qint64)));
connect(m_session, SIGNAL(actualLocationChanged(QUrl)), this, SIGNAL(actualLocationChanged(QUrl)));
connect(m_session, SIGNAL(videoError(int,QString)), this, SIGNAL(error(int,QString)));
}
示例11: QMediaPlayerControl
QT_BEGIN_NAMESPACE
QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent)
: QMediaPlayerControl(parent)
, m_ownStream(false)
, m_session(session)
, m_userRequestedState(QMediaPlayer::StoppedState)
, m_currentState(QMediaPlayer::StoppedState)
, m_mediaStatus(QMediaPlayer::NoMedia)
, m_bufferProgress(-1)
, m_pendingSeekPosition(-1)
, m_setMediaPending(false)
, m_stream(0)
{
m_resources = QMediaResourcePolicy::createResourceSet<QMediaPlayerResourceSetInterface>();
Q_ASSERT(m_resources);
connect(m_session, SIGNAL(positionChanged(qint64)),
this, SIGNAL(positionChanged(qint64)));
connect(m_session, SIGNAL(durationChanged(qint64)),
this, SIGNAL(durationChanged(qint64)));
connect(m_session, SIGNAL(mutedStateChanged(bool)),
this, SIGNAL(mutedChanged(bool)));
connect(m_session, SIGNAL(volumeChanged(int)),
this, SIGNAL(volumeChanged(int)));
connect(m_session, SIGNAL(stateChanged(QMediaPlayer::State)),
this, SLOT(updateSessionState(QMediaPlayer::State)));
connect(m_session,SIGNAL(bufferingProgressChanged(int)),
this, SLOT(setBufferProgress(int)));
connect(m_session, SIGNAL(playbackFinished()),
this, SLOT(processEOS()));
connect(m_session, SIGNAL(audioAvailableChanged(bool)),
this, SIGNAL(audioAvailableChanged(bool)));
connect(m_session, SIGNAL(videoAvailableChanged(bool)),
this, SIGNAL(videoAvailableChanged(bool)));
connect(m_session, SIGNAL(seekableChanged(bool)),
this, SIGNAL(seekableChanged(bool)));
connect(m_session, SIGNAL(error(int,QString)),
this, SIGNAL(error(int,QString)));
connect(m_session, SIGNAL(invalidMedia()),
this, SLOT(handleInvalidMedia()));
connect(m_session, SIGNAL(playbackRateChanged(qreal)),
this, SIGNAL(playbackRateChanged(qreal)));
connect(m_resources, SIGNAL(resourcesGranted()), SLOT(handleResourcesGranted()));
//denied signal should be queued to have correct state update process,
//since in playOrPause, when acquire is call on resource set, it may trigger a resourcesDenied signal immediately,
//so handleResourcesDenied should be processed later, otherwise it will be overwritten by state update later in playOrPause.
connect(m_resources, SIGNAL(resourcesDenied()), this, SLOT(handleResourcesDenied()), Qt::QueuedConnection);
connect(m_resources, SIGNAL(resourcesLost()), SLOT(handleResourcesLost()));
}
示例12: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
ui->horizontalSlider->setRange(0, 0);
ui->tableWidget->hide();
ui->tableWidget->hideColumn(2);
volume=80;
createContextMenu();
createSystemTrayIcon();
playList=new QMediaPlaylist;
playList->setPlaybackMode(QMediaPlaylist::Loop);
player=new QMediaPlayer;
player->setPlaylist(playList);
player->setVolume(volume);
connect(ui->horizontalSlider, SIGNAL(sliderMoved(int)), this, SLOT(setPosition(int)));
connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(playTo(int, int)));
connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
connect(playList, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSongList(int)));
connect(ui->action_SongList, SIGNAL(triggered()), this, SLOT(showOrHideSongList()));
connect(ui->action_Import, SIGNAL(triggered()), this, SLOT(importSongs()));
connect(ui->action_Last, SIGNAL(triggered()), this, SLOT(playLast()));
connect(ui->action_Play, SIGNAL(triggered()), this, SLOT(playOrPause()));
connect(ui->action_Stop, SIGNAL(triggered()), player, SLOT(stop()));
connect(ui->action_Next, SIGNAL(triggered()), this, SLOT(playNext()));
connect(ui->action_SoundPlus, SIGNAL(triggered()), this, SLOT(plusSound()));
connect(ui->action_SoundReduce, SIGNAL(triggered()), this, SLOT(reduceSound()));
connect(ui->action_Mode1, SIGNAL(triggered()), this, SLOT(setPlaybackMode1()));
connect(ui->action_Mode2, SIGNAL(triggered()), this, SLOT(setPlaybackMode2()));
connect(ui->action_Mode3, SIGNAL(triggered()), this, SLOT(setPlaybackMode3()));
connect(ui->action_Mode4, SIGNAL(triggered()), this, SLOT(setPlaybackMode4()));
connect(ui->action_Support, SIGNAL(triggered()), this, SLOT(support()));
connect(ui->action_About, SIGNAL(triggered()), this, SLOT(aboutUs()));
connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(close()));
connect(ui->toolButton_Last, SIGNAL(clicked()), this, SLOT(playLast()));
connect(ui->toolButton_Play, SIGNAL(clicked()), this, SLOT(playOrPause()));
connect(ui->toolButton_Stop, SIGNAL(clicked()), player, SLOT(stop()));
connect(ui->toolButton_Next, SIGNAL(clicked()), this, SLOT(playNext()));
}
示例13: connect
void Music::setConnect()
{
connect(ui->actionAddfile, SIGNAL(triggered()), this, SLOT(add_file_triggered()));
connect(ui->actionAddFolder, SIGNAL(triggered()), this, SLOT(add_folder_triggered()));
connect(ui->actionClear, SIGNAL(triggered()), this, SLOT(clear_clicked()));
connect(ui->action_once, SIGNAL(triggered()), this, SLOT(once_clicked()));
connect(ui->action_repeat, SIGNAL(triggered()), this, SLOT(repeat_clicked()));
connect(ui->action_shuffle, SIGNAL(triggered()), this, SLOT(shuffle_clicked()));
connect(ui->locate, SIGNAL(sliderMoved(int)), this, SLOT(setPosition(int)));
connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
connect(ui->listMusic,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(listMusic_customContextMenuRequested(QPoint)));
}
示例14: QWidget
VideoPlayer::VideoPlayer(QWidget *parent)
: QWidget(parent)
, mediaPlayer(0, QMediaPlayer::VideoSurface)
, playButton(0)
, positionSlider(0)
// , errorLabel(0)
{
QVideoWidget *videoWidget = new QVideoWidget;
QAbstractButton *openButton = new QPushButton(tr("Open..."));
connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
playButton = new QPushButton;
playButton->setEnabled(false);
playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
connect(playButton, SIGNAL(clicked()),
this, SLOT(play()));
positionSlider = new QSlider(Qt::Horizontal);
positionSlider->setRange(0, 0);
connect(positionSlider, SIGNAL(sliderMoved(int)),
this, SLOT(setPosition(int)));
//errorLabel = new QLabel;
//errorLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
QBoxLayout *controlLayout = new QHBoxLayout;
controlLayout->setMargin(0);
controlLayout->addWidget(openButton);
controlLayout->addWidget(playButton);
controlLayout->addWidget(positionSlider);
QBoxLayout *layout = new QVBoxLayout;
layout->addWidget(videoWidget);
layout->addLayout(controlLayout);
//layout->addWidget(errorLabel);
setLayout(layout);
mediaPlayer.setVideoOutput(videoWidget);
connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
this, SLOT(mediaStateChanged(QMediaPlayer::State)));
connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
connect(&mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(handleError()));
}
示例15: QMainWindow
MusicPlayer::MusicPlayer(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MusicPlayer)
{
ui->setupUi(this);
Player = new QMediaPlayer(this);
PlayList = new QMediaPlaylist;
connect(Player,SIGNAL(positionChanged(qint64)),this,SLOT(PositionChanged(qint64)));
connect(ui->LengthSlider,SIGNAL(sliderMoved(int)),this,SLOT(SetPosition(int)));
connect(Player,SIGNAL(durationChanged(qint64)),this,SLOT(DurationChanged(qint64)));
connect(Player,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),this,SLOT(StatusChanged(QMediaPlayer::MediaStatus)));
connect(ui->VolumeSlider,SIGNAL(valueChanged(int)),this,SLOT(SetVolume(int)));
connect(ui->button_start,SIGNAL(released()),this,SLOT(Play()));
connect(ui->button_stop,SIGNAL(released()),this,SLOT(Stop()));
connect(ui->button_next,SIGNAL(released()),this,SLOT(Next()));
connect(ui->button_prev,SIGNAL(released()),this,SLOT(Prev()));
connect(ui->button_add,SIGNAL(released()),this,SLOT(Add()));
connect(ui->button_remove,SIGNAL(released()),this,SLOT(Remove()));
connect(ui->playlist,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(PlaySelected(QModelIndex)));
connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(SavePlayList()));
connect(ui->actionLoad,SIGNAL(triggered()),this,SLOT(OpenPlayList()));
Player->setPlaylist(PlayList);
ui->VolumeSlider->setRange(0,100);
ui->VolumeSlider->setValue(100);
}