Fix correspondence between QFileDialog::Option and QFileDialogOption::FileDialogOptions

It was broken by fe4a5a27e0.

Pick-to: 6.2
Change-Id: I77da7ec9cdedc80a72b7f11980950a8bebfdaf3b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Alexander Volkov 2021-10-18 22:25:07 +03:00 committed by Volker Hilsheimer
parent edfb0922ea
commit 056e807bb1
3 changed files with 13 additions and 4 deletions

View File

@ -314,15 +314,16 @@ public:
enum DialogLabel { LookIn, FileName, FileType, Accept, Reject, DialogLabelCount };
Q_ENUM(DialogLabel)
// keep this in sync with QFileDialog::Options
enum FileDialogOption
{
ShowDirsOnly = 0x00000001,
DontResolveSymlinks = 0x00000002,
DontConfirmOverwrite = 0x00000004,
DontUseNativeDialog = 0x00000010,
ReadOnly = 0x00000020,
HideNameFilterDetails = 0x00000040,
DontUseCustomDirectoryIcons = 0x00000080
DontUseNativeDialog = 0x00000008,
ReadOnly = 0x00000010,
HideNameFilterDetails = 0x00000020,
DontUseCustomDirectoryIcons = 0x00000040
};
Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption)
Q_FLAG(FileDialogOptions)

View File

@ -830,6 +830,13 @@ void QFileDialog::setOptions(Options options)
QFileDialog::Options QFileDialog::options() const
{
Q_D(const QFileDialog);
static_assert((int)QFileDialog::ShowDirsOnly == (int)QFileDialogOptions::ShowDirsOnly);
static_assert((int)QFileDialog::DontResolveSymlinks == (int)QFileDialogOptions::DontResolveSymlinks);
static_assert((int)QFileDialog::DontConfirmOverwrite == (int)QFileDialogOptions::DontConfirmOverwrite);
static_assert((int)QFileDialog::DontUseNativeDialog == (int)QFileDialogOptions::DontUseNativeDialog);
static_assert((int)QFileDialog::ReadOnly == (int)QFileDialogOptions::ReadOnly);
static_assert((int)QFileDialog::HideNameFilterDetails == (int)QFileDialogOptions::HideNameFilterDetails);
static_assert((int)QFileDialog::DontUseCustomDirectoryIcons == (int)QFileDialogOptions::DontUseCustomDirectoryIcons);
return QFileDialog::Options(int(d->options->options()));
}

View File

@ -79,6 +79,7 @@ public:
Q_ENUM(AcceptMode)
enum DialogLabel { LookIn, FileName, FileType, Accept, Reject };
// keep this in sync with QFileDialogOption::FileDialogOptions
enum Option
{
ShowDirsOnly = 0x00000001,