Commit 5e700235 authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

Set a black background in the video widget

The black background is removed when the playback is starting and set
back again when the video is over. That way the black background does
not change the appearance of the video (and its proportions).
parent 5fcdb390
......@@ -43,6 +43,12 @@ PreviewWidget::PreviewWidget( GenericRenderer* genericRenderer, QWidget *parent
m_ui->seekSlider->setSingleStep( 2 );
m_ui->seekSlider->setFocusPolicy( Qt::NoFocus );
// Prepare and set the black background
m_ui->renderWidget->setAutoFillBackground( true );
m_videoPalette = m_ui->renderWidget->palette();
m_videoPalette.setColor( QPalette::Window, QColor( Qt::black ) );
m_ui->renderWidget->setPalette( m_videoPalette );
setAcceptDrops( false );
connect( m_ui->seekSlider, SIGNAL( sliderPressed() ), this, SLOT( seekSliderPressed() ) );
......@@ -145,11 +151,17 @@ void PreviewWidget::videoStopped()
{
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/play" ) );
m_ui->seekSlider->setValue( 0 );
// Set the black background
m_ui->renderWidget->setPalette( m_videoPalette );
}
void PreviewWidget::videoPlaying()
{
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/pause" ) );
// Remove the black background
m_ui->renderWidget->setPalette( QPalette() );
}
void PreviewWidget::endReached()
......@@ -158,6 +170,9 @@ void PreviewWidget::endReached()
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/play" ) );
m_ui->seekSlider->setValue( 0 );
// Set the black background
m_ui->renderWidget->setPalette( m_videoPalette );
}
void PreviewWidget::on_pushButtonNextFrame_clicked()
......
......@@ -47,6 +47,7 @@ private:
GenericRenderer* m_renderer;
bool m_endReached;
bool m_previewStopped;
QPalette m_videoPalette;
protected:
virtual void changeEvent( QEvent *e );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment