[vlc-commits] gui/qt: dialogs/plugins: prevent deprecated usage of QStyleOptionViewItemV4 if Qt >= 5
Filip Roséen
git at videolan.org
Mon Mar 20 13:53:07 CET 2017
vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Mar 20 13:41:56 2017 +0100| [dda5dda889e6975bb51491ad264eae57adc1b901] | committer: Hugo Beauzée-Luyssen
gui/qt: dialogs/plugins: prevent deprecated usage of QStyleOptionViewItemV4 if Qt >= 5
QStyleOptionViewItemV4 is deprecated starting from Qt5, and the
warning diagnostic when compiling with Qt5 has been bugging me for
quite some time.
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dda5dda889e6975bb51491ad264eae57adc1b901
---
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 4e8d273..6a61d07 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();
More information about the vlc-commits
mailing list