mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 22:19:12 +02:00
Qt5,Qt6: fixed Qt version extraction. issue #40426
This commit is contained in:
parent
d04f10985e
commit
dffc3b9594
@ -510,43 +510,26 @@ end;
|
|||||||
procedure QtVersionInt(out AMajor, AMinor, AMicro: integer);
|
procedure QtVersionInt(out AMajor, AMinor, AMicro: integer);
|
||||||
var
|
var
|
||||||
S: String;
|
S: String;
|
||||||
i: Integer;
|
AList: TStringList;
|
||||||
sLen: integer;
|
|
||||||
begin
|
begin
|
||||||
AMajor := 0;
|
AMajor := 0;
|
||||||
AMinor := 0;
|
AMinor := 0;
|
||||||
AMicro := 0;
|
AMicro := 0;
|
||||||
S := GetQtVersion;
|
S := GetQtVersion;
|
||||||
sLen := length(S);
|
|
||||||
|
|
||||||
// 5 is usual length of qt5 version eg. 5.6.1
|
// 5 is usual length of qt5 version eg. 5.6.1
|
||||||
if sLen < 5 then
|
if length(S) < 5 then
|
||||||
exit;
|
exit;
|
||||||
if sLen = 5 then
|
|
||||||
begin
|
AList := TStringList.Create;
|
||||||
TryStrToInt(S[1], AMajor);
|
try
|
||||||
TryStrToInt(S[3], AMinor);
|
AList.Delimiter := '.';
|
||||||
TryStrToInt(S[5], AMicro);
|
AList.DelimitedText := S;
|
||||||
end else
|
TryStrToInt(AList[0], AMajor);
|
||||||
begin
|
TryStrToInt(AList[1], AMinor);
|
||||||
i := Pos('.', S);
|
TryStrToInt(AList[2], AMicro);
|
||||||
// major
|
finally
|
||||||
if i > 0 then
|
AList.Free;
|
||||||
begin
|
|
||||||
TryStrToInt(Copy(S, 1, i -1), AMajor);
|
|
||||||
Delete(S, 1, i - 1);
|
|
||||||
end;
|
|
||||||
// minor
|
|
||||||
i := Pos('.', S);
|
|
||||||
if i > 0 then
|
|
||||||
begin
|
|
||||||
TryStrToInt(Copy(S, 1, i -1), AMinor);
|
|
||||||
Delete(S, 1, i - 1);
|
|
||||||
end;
|
|
||||||
// micro
|
|
||||||
i := Pos('.', S);
|
|
||||||
if i > 0 then
|
|
||||||
TryStrToInt(Copy(S, 1, i -1), AMinor);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -509,43 +509,26 @@ end;
|
|||||||
procedure QtVersionInt(out AMajor, AMinor, AMicro: integer);
|
procedure QtVersionInt(out AMajor, AMinor, AMicro: integer);
|
||||||
var
|
var
|
||||||
S: String;
|
S: String;
|
||||||
i: Integer;
|
AList: TStringList;
|
||||||
sLen: integer;
|
|
||||||
begin
|
begin
|
||||||
AMajor := 0;
|
AMajor := 0;
|
||||||
AMinor := 0;
|
AMinor := 0;
|
||||||
AMicro := 0;
|
AMicro := 0;
|
||||||
S := GetQtVersion;
|
S := GetQtVersion;
|
||||||
sLen := length(S);
|
|
||||||
|
|
||||||
// 5 is usual length of qt5 version eg. 5.6.1
|
// 5 is usual length of qt5 version eg. 5.6.1
|
||||||
if sLen < 5 then
|
if length(S) < 5 then
|
||||||
exit;
|
exit;
|
||||||
if sLen = 5 then
|
|
||||||
begin
|
AList := TStringList.Create;
|
||||||
TryStrToInt(S[1], AMajor);
|
try
|
||||||
TryStrToInt(S[3], AMinor);
|
AList.Delimiter := '.';
|
||||||
TryStrToInt(S[5], AMicro);
|
AList.DelimitedText := S;
|
||||||
end else
|
TryStrToInt(AList[0], AMajor);
|
||||||
begin
|
TryStrToInt(AList[1], AMinor);
|
||||||
i := Pos('.', S);
|
TryStrToInt(AList[2], AMicro);
|
||||||
// major
|
finally
|
||||||
if i > 0 then
|
AList.Free;
|
||||||
begin
|
|
||||||
TryStrToInt(Copy(S, 1, i -1), AMajor);
|
|
||||||
Delete(S, 1, i - 1);
|
|
||||||
end;
|
|
||||||
// minor
|
|
||||||
i := Pos('.', S);
|
|
||||||
if i > 0 then
|
|
||||||
begin
|
|
||||||
TryStrToInt(Copy(S, 1, i -1), AMinor);
|
|
||||||
Delete(S, 1, i - 1);
|
|
||||||
end;
|
|
||||||
// micro
|
|
||||||
i := Pos('.', S);
|
|
||||||
if i > 0 then
|
|
||||||
TryStrToInt(Copy(S, 1, i -1), AMinor);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user