Avoid deprecation warnings with Qt 5.7
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 27 Sep 2016 20:28:46 +0000 (22:28 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 4 Apr 2018 21:14:03 +0000 (23:14 +0200)
The versioned QStyleOption derivatives are deprecated in Qt 5,
and Qt 5.7 actually gets noisy about that. So remove these by
the unversioned class names.

(cherry picked from commit 8eab2bd6ca5c9b8de11ed1db6d0900d9c9360a5d)

src/uisupport/bufferview.cpp
src/uisupport/multilineedit.cpp

index cb2ca0b..76bb297 100644 (file)
@@ -622,7 +622,11 @@ bool BufferViewDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, c
     if (!value.isValid())
         return QStyledItemDelegate::editorEvent(event, model, option, index);
 
+#if QT_VERSION < 0x050000
     QStyleOptionViewItemV4 viewOpt(option);
+#else
+    QStyleOptionViewItem viewOpt(option);
+#endif
     initStyleOption(&viewOpt, index);
 
     QRect checkRect = viewOpt.widget->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &viewOpt, viewOpt.widget);
index 3c7f959..eba2729 100644 (file)
@@ -178,7 +178,11 @@ void MultiLineEdit::updateSizeHint()
 
     // use the style to determine a decent size
     int h = qMin(qMax((int)document()->size().height() + scrollBarHeight, minPixelHeight), maxPixelHeight) + 2 * frameWidth();
+#if QT_VERSION < 0x050000
     QStyleOptionFrameV2 opt;
+#else
+    QStyleOptionFrame opt;
+#endif
     opt.initFrom(this);
     opt.rect = QRect(0, 0, 100, h);
     opt.lineWidth = lineWidth();