From d6d33f0b80dd85043c71f71a3ed5485d6014e6c4 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 26 Jan 2019 20:02:53 +0100 Subject: QtWidgets: mark obsolete functions as deprecated Mark some long obsolete functions as deprecated so the can be removed with Qt6: - QLayout::margin()/setMargin() - QComboBox::autoCompletion()/setAutoCompletion() - QComboBox::autoCompletionCaseSensitivity() - QComboBox::setAutoCompletionCaseSensitivity() - QTextStream& operator<<(QTextStream&, const QSplitter&) - QTextStream& operator>>(QTextStream&, QSplitter&); Change-Id: Ic16b36bf647413b5b3ea2d9105981b95370b3178 Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/widgets/kernel/qlayout.cpp | 18 ++++++++++-------- src/widgets/kernel/qlayout.h | 8 ++++++-- src/widgets/widgets/qcombobox.cpp | 2 ++ src/widgets/widgets/qcombobox.h | 4 ++++ src/widgets/widgets/qsplitter.cpp | 2 ++ src/widgets/widgets/qsplitter.h | 4 ++++ 6 files changed, 28 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 090abc883d..f27851c7bb 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -282,6 +282,7 @@ bool QLayout::setAlignment(QLayout *l, Qt::Alignment alignment) return false; } +#if QT_DEPRECATED_SINCE(5, 13) /*! \property QLayout::margin \brief the width of the outside border of the layout @@ -306,6 +307,15 @@ int QLayout::margin() const } } +/*! + \obsolete +*/ +void QLayout::setMargin(int margin) +{ + setContentsMargins(margin, margin, margin, margin); +} + +#endif /*! \property QLayout::spacing \brief the spacing between widgets inside the layout @@ -344,14 +354,6 @@ int QLayout::spacing() const } } -/*! - \obsolete -*/ -void QLayout::setMargin(int margin) -{ - setContentsMargins(margin, margin, margin, margin); -} - void QLayout::setSpacing(int spacing) { if (QBoxLayout* boxlayout = qobject_cast(this)) { diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h index 616f4e7164..35a04a35b2 100644 --- a/src/widgets/kernel/qlayout.h +++ b/src/widgets/kernel/qlayout.h @@ -63,7 +63,9 @@ class Q_WIDGETS_EXPORT QLayout : public QObject, public QLayoutItem Q_OBJECT Q_DECLARE_PRIVATE(QLayout) +#if QT_DEPRECATED_SINCE(5, 13) Q_PROPERTY(int margin READ margin WRITE setMargin) +#endif Q_PROPERTY(int spacing READ spacing WRITE setSpacing) Q_PROPERTY(SizeConstraint sizeConstraint READ sizeConstraint WRITE setSizeConstraint) public: @@ -81,10 +83,12 @@ public: QLayout(); ~QLayout(); +#if QT_DEPRECATED_SINCE(5, 13) int margin() const; - int spacing() const; - void setMargin(int); +#endif + + int spacing() const; void setSpacing(int); void setContentsMargins(int left, int top, int right, int bottom); diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 2f67a9202c..2c478f364d 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1483,6 +1483,7 @@ int QComboBox::maxCount() const } #if QT_CONFIG(completer) +#if QT_DEPRECATED_SINCE(5, 13) /*! \property QComboBox::autoCompletion @@ -1576,6 +1577,7 @@ void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity if (d->lineEdit && d->lineEdit->completer()) d->lineEdit->completer()->setCaseSensitivity(sensitivity); } +#endif // QT_DEPRECATED_SINCE(5, 13) #endif // QT_CONFIG(completer) diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 671c883584..542a3bd3b9 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -73,8 +73,10 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) #if QT_CONFIG(completer) +#if QT_DEPRECATED_SINCE(5, 13) Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion DESIGNABLE false) Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity DESIGNABLE false) +#endif #endif // QT_CONFIG(completer) Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled) @@ -93,11 +95,13 @@ public: int maxCount() const; #if QT_CONFIG(completer) +#if QT_DEPRECATED_SINCE(5, 13) bool autoCompletion() const; void setAutoCompletion(bool enable); Qt::CaseSensitivity autoCompletionCaseSensitivity() const; void setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity); +#endif #endif bool duplicatesEnabled() const; diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 9e38c8f18a..0b90714363 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -1783,6 +1783,7 @@ void QSplitter::setStretchFactor(int index, int stretch) } +#if QT_DEPRECATED_SINCE(5, 13) /*! \relates QSplitter \obsolete @@ -1813,6 +1814,7 @@ QTextStream& operator>>(QTextStream& ts, QSplitter& splitter) splitter.restoreState(std::move(line).toLatin1()); return ts; } +#endif QT_END_NAMESPACE diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h index 16fac48d1c..ec980d9ee3 100644 --- a/src/widgets/widgets/qsplitter.h +++ b/src/widgets/widgets/qsplitter.h @@ -129,8 +129,12 @@ private: friend class QSplitterHandle; }; +#if QT_DEPRECATED_SINCE(5, 13) +QT_DEPRECATED_X("Use QSplitter::saveState() instead") Q_WIDGETS_EXPORT QTextStream& operator<<(QTextStream&, const QSplitter&); +QT_DEPRECATED_X("Use QSplitter::restoreState() instead") Q_WIDGETS_EXPORT QTextStream& operator>>(QTextStream&, QSplitter&); +#endif class QSplitterHandlePrivate; class Q_WIDGETS_EXPORT QSplitterHandle : public QWidget -- cgit v1.2.3