I am writing an application using <Phonon/VideoWidget>
.
I'd like to have two windows. One is the main window with controls for the video And the other has the video itself. It will be displayed in another monitor. -fullscreen or not.
How can I make the video window - that can be moved or resizabled - with the video inside?
When not playing any video, the video window should display an image.
In the end I didnt use QStackedWidget, I extended Phonon::VideoWidget and made this class...
Heres the cpp:
MyVideoWidget::MyVideoWidget(QWidget *parent) : Phonon::VideoWidget(parent)
{
label = new QLabel(this);
label->setAutoFillBackground(true);
label->setBackgroundRole(QPalette::Light);
label->setScaledContents(true);
}
void MyVideoWidget::mouseDoubleClickEvent(QMouseEvent* event)
{
if(!this->isFullScreen())
this->enterFullScreen();
else
this->setFullScreen(false);
}
void MyVideoWidget::keyPressEvent(QKeyEvent* event)
{
if(event->key() == Qt::Key_Escape)
{
if(!this->isFullScreen())
this->enterFullScreen();
else
this->setFullScreen(false);
}
}
void MyVideoWidget::enterImageMode(QString imagePath)
{
QPixmap pmap;
pmap.fill(QColor(255, 255, 255));
if(!pmap.load(imagePath))
{
label->setText("Erro ao carregar imagem: "+imagePath);
if(!label->isVisible())
label->show();
return;
}
label->setPixmap(pmap);
if(!label->isVisible())
label->show();
repaint();
}
void MyVideoWidget::enterVideoMode()
{
label->hide();
}
void MyVideoWidget::resizeEvent(QResizeEvent* event)
{
Phonon::VideoWidget::resizeEvent(event);
label->setGeometry(this->geometry());
repaint();
}
MyVideoWidget::~MyVideoWidget()
{
}