QComboBox: deprecate SizeAdjustPolicy::AdjustToMinimumContentLength

As per ### Qt 6 comment and pre-existing documentation, one of the
other enum values should be used anyway.
Only usage in QtWidgets is in QFileDialog, replace it there with
appropriate alternative.

[ChangeLog][QtWidgets][QComboBox] the SizeAdjustPolicy value
AdjustToMinimumContentLength is deprecated, use AdjustToContents or
AdjustToContentsOnFirstShow instead.

Change-Id: I22deaa31fbb6c09e87c814e120eb7ee27c177ea9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-02-25 15:41:54 +01:00
parent f15aa1fd84
commit 469c333840
3 changed files with 7 additions and 4 deletions

View File

@ -3144,7 +3144,7 @@ void QFileDialogPrivate::createWidgets()
// filetype
qFileDialogUi->fileTypeCombo->setDuplicatesEnabled(false);
qFileDialogUi->fileTypeCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
qFileDialogUi->fileTypeCombo->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
qFileDialogUi->fileTypeCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QObject::connect(qFileDialogUi->fileTypeCombo, SIGNAL(activated(int)),
q, SLOT(_q_useNameFilter(int)));

View File

@ -894,7 +894,7 @@ 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.
\value AdjustToMinimumContentsLength Use AdjustToContents or AdjustToContentsOnFirstShow instead.
\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.
*/

View File

@ -137,8 +137,11 @@ public:
enum SizeAdjustPolicy {
AdjustToContents,
AdjustToContentsOnFirstShow,
AdjustToMinimumContentsLength, // ### Qt 6: remove
AdjustToMinimumContentsLengthWithIcon
#if QT_DEPRECATED_SINCE(5, 15)
AdjustToMinimumContentsLength Q_DECL_ENUMERATOR_DEPRECATED_X(
"Use AdjustToContents or AdjustToContentsOnFirstShow"), // ### Qt 6: remove
#endif
AdjustToMinimumContentsLengthWithIcon = AdjustToContentsOnFirstShow + 2
};
Q_ENUM(SizeAdjustPolicy)