[vlc-devel] [PATCH 6/8] gui/qt: dialogs/plugins: prevent deprecated usage of QStyleOptionViewItemV4 if Qt >= 5

Filip Roséen filip at atch.se
Mon Mar 20 13:41:56 CET 2017


QStyleOptionViewItemV4 is deprecated starting from Qt5, and the
warning diagnostic when compiling with Qt5 has been bugging me for
quite some time.
---
 modules/gui/qt/dialogs/plugins.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/gui/qt/dialogs/plugins.cpp b/modules/gui/qt/dialogs/plugins.cpp
index 4e8d27363a..6a61d07671 100644
--- a/modules/gui/qt/dialogs/plugins.cpp
+++ b/modules/gui/qt/dialogs/plugins.cpp
@@ -1039,7 +1039,11 @@ void ExtensionItemDelegate::paint( QPainter *painter,
                                    const QStyleOptionViewItem &option,
                                    const QModelIndex &index ) const
 {
+#if HAS_QT5
+    QStyleOptionViewItem opt = option;
+#else
     QStyleOptionViewItemV4 opt = option;
+#endif
     initStyleOption( &opt, index );
 
     // Draw background
@@ -1122,7 +1126,11 @@ void AddonItemDelegate::paint( QPainter *painter,
                                const QStyleOptionViewItem &option,
                                const QModelIndex &index ) const
 {
+#if HAS_QT5
+    QStyleOptionViewItem newopt = option;
+#else
     QStyleOptionViewItemV4 newopt = option;
+#endif
     int i_state = index.data( AddonsListModel::StateRole ).toInt();
     int i_type = index.data( AddonsListModel::TypeRole ).toInt();
 
-- 
2.12.0


More information about the vlc-devel mailing list