vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Fri Feb 
23 17:15:03 2018 +0100| [7852988b9a052eeaf3770897b22a8e228a3eef6c] | committer: 
Francois Cartegnie

Qt: fix drawing of preview (#18109)

(cherry picked from commit 02116660d5c8ec27d01dfba4e43345984b4c6241)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=7852988b9a052eeaf3770897b22a8e228a3eef6c
---

 modules/gui/qt/dialogs/toolbar.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/gui/qt/dialogs/toolbar.cpp 
b/modules/gui/qt/dialogs/toolbar.cpp
index 07196cc113..b71dfe5d97 100644
--- a/modules/gui/qt/dialogs/toolbar.cpp
+++ b/modules/gui/qt/dialogs/toolbar.cpp
@@ -315,9 +315,18 @@ void PreviewWidget::paintEvent( QPaintEvent * )
     int i_total = 0, i_offset = 0, i;
     QPainter painter( this );
     QPixmap pixmaps[3];
+
     for( int i=0; i<3; i++ )
     {
         pixmaps[i] = bars[i]->grab( bars[i]->contentsRect() );
+        /* Because non shown widgets do not have their bitmap updated, we need
+           to force redraw to grab a pixmap matching layout size */
+        if( pixmaps[i].size() != bars[i]->contentsRect().size() )
+        {
+            bars[i]->layout()->invalidate();
+            pixmaps[i] = bars[i]->grab( bars[i]->contentsRect() );
+        }
+
         for( int j=0; j < bars[i]->layout()->count(); j++ )
         {
             QLayoutItem *item = bars[i]->layout()->itemAt( j );

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to