[vlc-commits] Qt: fix drawing of preview (#18109)

Francois Cartegnie git at videolan.org
Fri Feb 23 17:18:49 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 23 17:15:03 2018 +0100| [02116660d5c8ec27d01dfba4e43345984b4c6241] | committer: Francois Cartegnie

Qt: fix drawing of preview (#18109)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=02116660d5c8ec27d01dfba4e43345984b4c6241
---

 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 );



More information about the vlc-commits mailing list