UPD: Enable dark mode (limited) under unsupported Windows versions

This commit is contained in:
Alexander Koblov 2022-02-14 18:35:17 +03:00
commit 4cf98dccdc
3 changed files with 12 additions and 5 deletions

View file

@ -416,9 +416,12 @@ var
Handle: HWND;
AWindow: QWidgetH;
begin
Handle:= GetWindowHandle(Form);
AllowDarkModeForWindow(Handle, True);
RefreshTitleBarThemeColor(Handle);
if g_darkModeSupported then
begin
Handle:= GetWindowHandle(Form);
AllowDarkModeForWindow(Handle, True);
RefreshTitleBarThemeColor(Handle);
end;
if (Form is THintWindow) then
begin

View file

@ -153,7 +153,7 @@ var
end;
begin
if not g_darkModeEnabled then Exit;
g_darkModeEnabled:= True;
QApplication_setStyle(QStyleFactory_create(@StyleName));

View file

@ -341,7 +341,11 @@ begin
{$IF DEFINED(MSWINDOWS) and DEFINED(LCLQT5)}
if g_darkModeEnabled then
ShowFlags:= ShowFlags or lcp_darkmode or lcp_darkmodenative;
begin
ShowFlags:= ShowFlags or lcp_darkmode;
if g_darkModeSupported then
ShowFlags:= ShowFlags or lcp_darkmodenative;
end;
{$ENDIF}
if Assigned(ListLoadW) then