PDA

View Full Version : Full Screen Double Click?



winston2020
11th February 2009, 20:39
I've got a Phonon::VideoPlayer which I've subclassed and reimplemented VideoPlayer::mouseDoubleClickEvent. I'm trying to have it enter fullscreen when double clicked, and exit when double clicked. So far, it will enter fullscreen, but then double click doesn't work.

VideoWindow.h


#pragma once
#include <QtGui>
#include <Phonon>

class VideoWindow : public Phonon::VideoPlayer
{
Q_OBJECT
public:
VideoWindow(Phonon::Category category, QWidget * parent = 0);

protected:
void mouseDoubleClickEvent( QMouseEvent *evt );
};


VideoWindow.cpp


#include "VideoWindow.h"

VideoWindow::VideoWindow(Phonon::Category category, QWidget *parent)
: VideoPlayer(category, parent)
{
}

void VideoWindow::mouseDoubleClickEvent( QMouseEvent *evt )
{
this->videoWidget()->setFullScreen(
!this->videoWidget()->isFullScreen() );
evt->accept();
}

boudie
11th February 2009, 21:24
isFullScreen() returns true if the widget occupies the whole screen.
To occupy the whole screen, it must not be a child within another widget or MainWindow, I think...
If VideoWindow is within another widget, maybe you can try to check on parentWidget()->isFullScreen().

Or you try to make use of windowState().

muellerp
12th February 2009, 08:26
Just have a look into the Media Player example / demo.

http://doc.trolltech.com/4.5/demos-mediaplayer.html

There the double click event is used for fullscreen switching.

chattsaurabh
3rd June 2010, 11:04
hi
try this

void VideoWindow::mouseDoubleClickEvent(QMouseEvent *event)
{
if(!fullScreenFlag)
{
qDebug() << "already full screen...closing";
this->showNormal();
}
else
{
qDebug() << "hi this is custom video player double click";
this->showFullScreen();
}

fullScreenFlag = !fullScreenFlag;
event->accept();
}

'fullScreenFlag' being a boolean entity.

cheers

saurabh

aamer4yu
3rd June 2010, 12:37
You need to capture the double click event for videowidget, and not videowindow. :rolleyes: