Remove deprecated QComboBox::SizeAdjustPolicy enum value

Change-Id: Ia8ae2eb11b86bc615e1297d7fabd1afcb821557c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-04-17 09:57:01 +02:00
parent 6dd90afb76
commit 1a342b2db1
3 changed files with 5 additions and 35 deletions

View File

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

View File

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

View File

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