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 <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Christian Ehrlicher 2019-01-26 20:02:53 +01:00 committed by Liang Qi
parent 4715ca7bc5
commit d6d33f0b80
6 changed files with 28 additions and 10 deletions

View File

@ -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<QBoxLayout*>(this)) {

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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