[vlc-commits] gui/qt: use QWidget::grab instead of deprecated QPixMap::grabWidget

Sebastian Ramacher git at videolan.org
Sun Mar 5 23:35:19 CET 2017


vlc | branch: master | Sebastian Ramacher <sramacher at debian.org> | Sun Mar  5 17:38:47 2017 +0100| [6250bd9078391b81c5b63a42b5fccc04c6b6761c] | committer: Jean-Baptiste Kempf

gui/qt: use QWidget::grab instead of deprecated QPixMap::grabWidget

Fixes "QPixmap::grabWidget is deprecated, use QWidget::grab() instead".

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt/dialogs/plugins.cpp | 6 ++++++
 modules/gui/qt/dialogs/toolbar.cpp | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/modules/gui/qt/dialogs/plugins.cpp b/modules/gui/qt/dialogs/plugins.cpp
index d3af829..9e05b08 100644
--- a/modules/gui/qt/dialogs/plugins.cpp
+++ b/modules/gui/qt/dialogs/plugins.cpp
@@ -1243,9 +1243,15 @@ void AddonItemDelegate::paint( QPainter *painter,
                 progressbar->setGeometry(
                     newopt.rect.adjusted( adjustment.width(), adjustment.height(),
                                           -adjustment.width(), -adjustment.height() ) );
+#if HAS_QT5
+                painter->drawPixmap( newopt.rect.left() + adjustment.width(),
+                                     newopt.rect.top() + adjustment.height(),
+                                     progressbar->grab() );
+#else
                 painter->drawPixmap( newopt.rect.left() + adjustment.width(),
                                      newopt.rect.top() + adjustment.height(),
                                      QPixmap::grabWidget( progressbar ) );
+#endif
             }
             painter->restore();
         }
diff --git a/modules/gui/qt/dialogs/toolbar.cpp b/modules/gui/qt/dialogs/toolbar.cpp
index dc90ef5..bc6b547 100644
--- a/modules/gui/qt/dialogs/toolbar.cpp
+++ b/modules/gui/qt/dialogs/toolbar.cpp
@@ -315,7 +315,11 @@ void PreviewWidget::paintEvent( QPaintEvent * )
     QPixmap pixmaps[3];
     for( int i=0; i<3; i++ )
     {
+#if HAS_QT5
+        pixmaps[i] = bars[i]->grab( bars[i]->contentsRect() );
+#else
         pixmaps[i] = QPixmap::grabWidget( bars[i], bars[i]->contentsRect() );
+#endif
         for( int j=0; j < bars[i]->layout()->count(); j++ )
         {
             QLayoutItem *item = bars[i]->layout()->itemAt( j );
@@ -573,7 +577,11 @@ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
         if( widget == NULL ) continue;
 
 
+#if HAS_QT5
+        widgetItem->setIcon( QIcon( widget->grab() ) );
+#else
         widgetItem->setIcon( QIcon( QPixmap::grabWidget( widget ) ) );
+#endif
         widgetItem->setToolTip( widgetItem->text() );
         widget->hide();
         widgetItem->setData( Qt::UserRole, QVariant( i ) );



More information about the vlc-commits mailing list