diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index 5d1d25a2dd..1c30b27175 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -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) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 2dbd7c07f8..935cfeb409 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -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())); } diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index 0a6b9e62ef..73136c3707 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -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,