From e53ecca1883cbf250c3b29c4cb6e50f3c7e66eec Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Tue, 27 Sep 2016 22:28:46 +0200 Subject: [PATCH] Avoid deprecation warnings with Qt 5.7 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 | 4 ++++ src/uisupport/multilineedit.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index cb2ca0bf..76bb2971 100644 --- a/src/uisupport/bufferview.cpp +++ b/src/uisupport/bufferview.cpp @@ -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); diff --git a/src/uisupport/multilineedit.cpp b/src/uisupport/multilineedit.cpp index 3c7f9593..eba27296 100644 --- a/src/uisupport/multilineedit.cpp +++ b/src/uisupport/multilineedit.cpp @@ -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(); -- 2.20.1