Add ShowDirectoriesFirst platform theme hint

This allows Qt Quick Dialogs to accurately check how it should show
files and directories.

Change-Id: I0f5102553ff9a0484b3714ba176f7e5e668fd05c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Mitch Curtis 2021-10-21 13:29:42 +02:00
parent 9151ab44bc
commit 3aa1a7fad1
3 changed files with 9 additions and 0 deletions

View File

@ -167,6 +167,10 @@ QT_BEGIN_NAMESPACE
as basis for the resize.
This enum value has been added in Qt 6.2.
\value ShowDirectoriesFirst (bool) Whether directories should be shown
first (before files) in file dialogs.
This enum value was added in Qt 6.2.
\sa themeHint(), QStyle::pixelMetric()
*/
@ -574,6 +578,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(10);
case InteractiveResizeAcrossScreens:
return true;
case ShowDirectoriesFirst:
return true;
}
return QVariant();
}

View File

@ -119,6 +119,7 @@ public:
IconFallbackSearchPaths,
MouseQuickSelectionThreshold,
InteractiveResizeAcrossScreens,
ShowDirectoriesFirst,
};
enum DialogType {

View File

@ -527,6 +527,8 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
return QVariant(bool([[NSApplication sharedApplication] presentationOptions] & NSApplicationPresentationFullScreen));
case QPlatformTheme::InteractiveResizeAcrossScreens:
return !NSScreen.screensHaveSeparateSpaces;
case QPlatformTheme::ShowDirectoriesFirst:
return false;
default:
break;
}