diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-04-17 09:57:01 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-04-27 12:22:33 +0200 |
commit | 1a342b2db14fa92bca717f5daff950b2eef869f7 (patch) | |
tree | b5f0c7d91554159798f8a840a2e8fcf88b0a6c88 | |
parent | 6dd90afb76ab46a3d7a90bd9dec6a5f8ab42a383 (diff) |
Remove deprecated QComboBox::SizeAdjustPolicy enum value
Change-Id: Ia8ae2eb11b86bc615e1297d7fabd1afcb821557c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 21 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.h | 6 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 13 |
3 files changed, 5 insertions, 35 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index fd82384c03..c236ab434b 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -385,16 +385,6 @@ int QComboBoxPrivate::computeWidthHint() const return tmp.width(); } -#if QT_DEPRECATED_SINCE(5, 15) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -static constexpr QComboBox::SizeAdjustPolicy deprecatedAdjustToMinimumContentsLength() -{ - return QComboBox::AdjustToMinimumContentsLength; -} -QT_WARNING_POP -#endif - QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const { Q_Q(const QComboBox); @@ -422,10 +412,6 @@ QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const } } break; - case deprecatedAdjustToMinimumContentsLength(): - for (int i = 0; i < count && !hasIcon; ++i) - hasIcon = !q->itemIcon(i).isNull(); - break; case QComboBox::AdjustToMinimumContentsLengthWithIcon: ; } @@ -905,8 +891,8 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const \value AdjustToContents The combobox will always adjust to the contents \value AdjustToContentsOnFirstShow The combobox will adjust to its contents the first time it is shown. - \omitvalue AdjustToMinimumContentsLength - \value AdjustToMinimumContentsLengthWithIcon The combobox will adjust to \l minimumContentsLength plus space for an icon. For performance reasons use this policy on large models. + \value AdjustToMinimumContentsLengthWithIcon The combobox will adjust to \l minimumContentsLength plus space for an icon. + For performance reasons use this policy on large models. */ /*! @@ -1753,8 +1739,7 @@ void QComboBox::setMinimumContentsLength(int characters) d->minimumContentsLength = characters; if (d->sizeAdjustPolicy == AdjustToContents - || d->sizeAdjustPolicy == deprecatedAdjustToMinimumContentsLength() - || d->sizeAdjustPolicy == AdjustToMinimumContentsLengthWithIcon) { + || d->sizeAdjustPolicy == AdjustToMinimumContentsLengthWithIcon) { d->sizeHint = QSize(); d->adjustComboBoxSize(); updateGeometry(); diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 1411d64143..38000e336b 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -137,11 +137,7 @@ public: enum SizeAdjustPolicy { AdjustToContents, AdjustToContentsOnFirstShow, -#if QT_DEPRECATED_SINCE(5, 15) - AdjustToMinimumContentsLength Q_DECL_ENUMERATOR_DEPRECATED_X( - "Use AdjustToContents or AdjustToContentsOnFirstShow"), // ### Qt 6: remove -#endif - AdjustToMinimumContentsLengthWithIcon = AdjustToContentsOnFirstShow + 2 + AdjustToMinimumContentsLengthWithIcon }; Q_ENUM(SizeAdjustPolicy) diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 10430e1796..444bf9d624 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -302,8 +302,6 @@ void tst_QComboBox::getSetCheck() QCOMPARE(QComboBox::SizeAdjustPolicy(QComboBox::AdjustToContents), obj1.sizeAdjustPolicy()); obj1.setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow)); QCOMPARE(QComboBox::SizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow), obj1.sizeAdjustPolicy()); - obj1.setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength)); - QCOMPARE(QComboBox::SizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength), obj1.sizeAdjustPolicy()); obj1.setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon)); QCOMPARE(QComboBox::SizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon), obj1.sizeAdjustPolicy()); @@ -531,19 +529,10 @@ void tst_QComboBox::sizeAdjustPolicy() testWidget->addItem("normal item"); QCOMPARE(testWidget->sizeHint(), firstShow); - // check that with minimumContentsLength/AdjustToMinimumContentsLength sizehint changes - testWidget->setMinimumContentsLength(30); - QCOMPARE(testWidget->sizeHint(), firstShow); - testWidget->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); - QSize minimumContentsLength = testWidget->sizeHint(); - QVERIFY(minimumContentsLength.width() > firstShow.width()); - testWidget->setMinimumContentsLength(60); - QVERIFY(minimumContentsLength.width() < testWidget->sizeHint().width()); - // check that with minimumContentsLength/AdjustToMinimumContentsLengthWithIcon sizehint changes testWidget->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); testWidget->setMinimumContentsLength(30); - minimumContentsLength = testWidget->sizeHint(); + QSize minimumContentsLength = testWidget->sizeHint(); QVERIFY(minimumContentsLength.width() > firstShow.width()); testWidget->setMinimumContentsLength(60); QVERIFY(minimumContentsLength.width() < testWidget->sizeHint().width()); |