mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:21:04 +02:00
Qt6: reduced num of string conversions, cleanup
(cherry picked from commit c630749f27
)
This commit is contained in:
parent
afef178fd6
commit
c4b93868c9
@ -508,7 +508,7 @@ procedure TQtWidgetSet.AppSetTitle(const ATitle: string);
|
|||||||
var
|
var
|
||||||
W: WideString;
|
W: WideString;
|
||||||
begin
|
begin
|
||||||
W := GetUtf8String(ATitle);
|
W := {%H-}ATitle;
|
||||||
QCoreApplication_setApplicationName(@W);
|
QCoreApplication_setApplicationName(@W);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1724,7 +1724,7 @@ procedure TQtFont.setFamily(p1: string);
|
|||||||
var
|
var
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
begin
|
begin
|
||||||
Str := GetUtf8String(p1);
|
Str := {%H-}p1;
|
||||||
|
|
||||||
QFont_setFamily(FHandle, @Str);
|
QFont_setFamily(FHandle, @Str);
|
||||||
end;
|
end;
|
||||||
@ -4985,7 +4985,7 @@ procedure TQtStringList.Insert(Index: Integer; const S: string);
|
|||||||
var
|
var
|
||||||
W: WideString;
|
W: WideString;
|
||||||
begin
|
begin
|
||||||
W := GetUtf8String(S);
|
W := {%H-}S;
|
||||||
QStringList_insert(FHandle, Index, @W);
|
QStringList_insert(FHandle, Index, @W);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -298,8 +298,7 @@ begin
|
|||||||
QtTabWidget.setUpdatesEnabled(False);
|
QtTabWidget.setUpdatesEnabled(False);
|
||||||
QtTabWidget.BeginUpdate;
|
QtTabWidget.BeginUpdate;
|
||||||
try
|
try
|
||||||
QtTabWidget.insertTab(AIndex, TQtPage(AChild.Handle).Widget,
|
QtTabWidget.insertTab(AIndex, TQtPage(AChild.Handle).Widget, AChild.Caption{%H-});
|
||||||
GetUtf8String(AChild.Caption));
|
|
||||||
finally
|
finally
|
||||||
QtTabWidget.EndUpdate;
|
QtTabWidget.EndUpdate;
|
||||||
QtTabWidget.setUpdatesEnabled(True);
|
QtTabWidget.setUpdatesEnabled(True);
|
||||||
@ -489,7 +488,7 @@ begin
|
|||||||
Index := AChild.PageIndex;
|
Index := AChild.PageIndex;
|
||||||
if Index < 0 then
|
if Index < 0 then
|
||||||
Index := ATabControl.IndexOf(AChild);
|
Index := ATabControl.IndexOf(AChild);
|
||||||
TQtTabWidget(ATabControl.Handle).setTabText(Index, GetUtf8String(AText));
|
TQtTabWidget(ATabControl.Handle).setTabText(Index, AText{%H-});
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TQtWSCustomTabControl.SetTabPosition(
|
class procedure TQtWSCustomTabControl.SetTabPosition(
|
||||||
|
@ -182,7 +182,7 @@ begin
|
|||||||
TextEdit := TQtTextEdit(FOwner.Handle);
|
TextEdit := TQtTextEdit(FOwner.Handle);
|
||||||
if ABlockSignals then
|
if ABlockSignals then
|
||||||
TextEdit.BeginUpdate;
|
TextEdit.BeginUpdate;
|
||||||
W := GetUtf8String(AStr);
|
W := AStr;
|
||||||
if AClear then
|
if AClear then
|
||||||
begin
|
begin
|
||||||
// never trigger changed signal when clearing text here.
|
// never trigger changed signal when clearing text here.
|
||||||
@ -288,7 +288,7 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
if FTextChanged then InternalUpdate;
|
if FTextChanged then InternalUpdate;
|
||||||
FStringList[Index] := S;
|
FStringList[Index] := S;
|
||||||
W := GetUTF8String(S);
|
W := {%H-}S;
|
||||||
TQtTextEdit(FOwner.Handle).setLineText(Index, W);
|
TQtTextEdit(FOwner.Handle).setLineText(Index, W);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ begin
|
|||||||
WriteLn('TQtMemoStrings.SetTextStr Value=',Value);
|
WriteLn('TQtMemoStrings.SetTextStr Value=',Value);
|
||||||
{$endif}
|
{$endif}
|
||||||
SetInternalText(Value);
|
SetInternalText(Value);
|
||||||
W := GetInternalText;
|
W := {%H-}GetInternalText;
|
||||||
ExternalUpdate(W, True, False);
|
ExternalUpdate(W, True, False);
|
||||||
FTextChanged := False;
|
FTextChanged := False;
|
||||||
end;
|
end;
|
||||||
@ -444,9 +444,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
Index := FStringList.Add(S);
|
Index := FStringList.Add(S);
|
||||||
if FHasTrailingLineBreak then
|
if FHasTrailingLineBreak then
|
||||||
W := GetUTF8String(S + LineBreak)
|
W := UTF8ToUTF16(S + LineBreak)
|
||||||
else
|
else
|
||||||
W := GetUTF8String(S);
|
W := UTF8ToUTF16(S);
|
||||||
if FHasTrailingLineBreak then
|
if FHasTrailingLineBreak then
|
||||||
begin
|
begin
|
||||||
//issue #39444
|
//issue #39444
|
||||||
@ -464,7 +464,7 @@ begin
|
|||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
FStringList.Insert(Index, S);
|
FStringList.Insert(Index, S);
|
||||||
W := GetUTF8String(S);
|
W := UTF8ToUTF16(S);
|
||||||
TQtTextEdit(FOwner.Handle).insertLine(Index, W);
|
TQtTextEdit(FOwner.Handle).insertLine(Index, W);
|
||||||
end;
|
end;
|
||||||
FTextChanged := False; // FStringList is already updated, no need to update from WS.
|
FTextChanged := False; // FStringList is already updated, no need to update from WS.
|
||||||
|
@ -46,7 +46,6 @@ type
|
|||||||
|
|
||||||
|
|
||||||
procedure FillStandardDescription(var Desc: TRawImageDescription);
|
procedure FillStandardDescription(var Desc: TRawImageDescription);
|
||||||
function GetUtf8String(const S: String): WideString;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -91,9 +90,4 @@ begin
|
|||||||
// Desc.MaskShift := 0;
|
// Desc.MaskShift := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetUtf8String(const S: String): WideString;
|
|
||||||
begin
|
|
||||||
Result := UTF8ToUTF16(S);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -340,8 +340,8 @@ var
|
|||||||
WHint: WideString;
|
WHint: WideString;
|
||||||
WTitle: WideString;
|
WTitle: WideString;
|
||||||
begin
|
begin
|
||||||
WHint := GetUTF8String(AHint);
|
WHint := {%H-}AHint;
|
||||||
WTitle := GetUTF8String(ATitle);
|
WTitle := {%H-}ATitle;
|
||||||
QSystemTrayIcon_showMessage(QSystemTrayIconH(TheObject), @WTitle, @WHint, AFlag, ATimeOut);
|
QSystemTrayIcon_showMessage(QSystemTrayIconH(TheObject), @WTitle, @WHint, AFlag, ATimeOut);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -617,7 +617,7 @@ begin
|
|||||||
case Details.Element of
|
case Details.Element of
|
||||||
teToolTip:
|
teToolTip:
|
||||||
begin
|
begin
|
||||||
W := GetUTF8String(S);
|
W := {%H-}S;
|
||||||
Context.save;
|
Context.save;
|
||||||
AOldMode := Context.SetBkMode(TRANSPARENT);
|
AOldMode := Context.SetBkMode(TRANSPARENT);
|
||||||
try
|
try
|
||||||
@ -661,7 +661,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
W := GetUTF8String(S);
|
W := {%H-}S;
|
||||||
Context.save;
|
Context.save;
|
||||||
try
|
try
|
||||||
Context.SetBkMode(TRANSPARENT);
|
Context.SetBkMode(TRANSPARENT);
|
||||||
@ -712,7 +712,7 @@ begin
|
|||||||
|
|
||||||
else
|
else
|
||||||
begin // default text drawing for all !
|
begin // default text drawing for all !
|
||||||
W := GetUTF8String(S);
|
W := {%H-}S;
|
||||||
Context.save;
|
Context.save;
|
||||||
AOldMode := Context.SetBkMode(TRANSPARENT);
|
AOldMode := Context.SetBkMode(TRANSPARENT);
|
||||||
if Context.Parent <> nil then
|
if Context.Parent <> nil then
|
||||||
|
@ -1373,9 +1373,9 @@ begin
|
|||||||
QtDC :=TQtDeviceContext(DC);
|
QtDC :=TQtDeviceContext(DC);
|
||||||
|
|
||||||
if Count >= 0 then
|
if Count >= 0 then
|
||||||
WideStr := GetUtf8String(Copy(Str, 1, Count))
|
WideStr := {%H-}Copy(Str, 1, Count)
|
||||||
else
|
else
|
||||||
WideStr := GetUtf8String(Str);
|
WideStr := Str;
|
||||||
|
|
||||||
ClipRect := Rect(0, 0, 0, 0);
|
ClipRect := Rect(0, 0, 0, 0);
|
||||||
B := QtDC.getClipping;
|
B := QtDC.getClipping;
|
||||||
@ -2188,16 +2188,12 @@ var
|
|||||||
while CurCount > 0 do
|
while CurCount > 0 do
|
||||||
begin
|
begin
|
||||||
CharLen := UTF8CodepointSize(CurStr);
|
CharLen := UTF8CodepointSize(CurStr);
|
||||||
|
W := {%H-}Copy(CurStr, 1, CharLen);
|
||||||
if AClipped then
|
if AClipped then
|
||||||
begin
|
|
||||||
W := GetUTF8String(Copy(CurStr, 1, CharLen));
|
|
||||||
QtDC.drawText(CurX, Y, Rect^.Right - Rect^.Left, Rect^.Bottom - Rect^.Top,
|
QtDC.drawText(CurX, Y, Rect^.Right - Rect^.Left, Rect^.Bottom - Rect^.Top,
|
||||||
QtTextDontClip, @W);
|
QtTextDontClip, @W)
|
||||||
end else
|
else
|
||||||
begin
|
|
||||||
W := GetUTF8String(Copy(CurStr, 1, CharLen));
|
|
||||||
QtDC.drawText(CurX, Y, @W);
|
QtDC.drawText(CurX, Y, @W);
|
||||||
end;
|
|
||||||
inc(CurX, CurDx^);
|
inc(CurX, CurDx^);
|
||||||
inc(CurDx);
|
inc(CurDx);
|
||||||
inc(CurStr, CharLen);
|
inc(CurStr, CharLen);
|
||||||
@ -2218,9 +2214,9 @@ begin
|
|||||||
if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then
|
if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then
|
||||||
begin
|
begin
|
||||||
if Count >= 0 then
|
if Count >= 0 then
|
||||||
WideStr := GetUtf8String(Copy(Str, 1, Count))
|
WideStr := {%H-}Copy(Str, 1, Count)
|
||||||
else
|
else
|
||||||
WideStr := GetUtf8String(Str);
|
WideStr := Str;
|
||||||
|
|
||||||
R := QtDC.getClipRegion.getBoundingRect;
|
R := QtDC.getClipRegion.getBoundingRect;
|
||||||
QtDC.font.Metrics.boundingRect(@R1, @R, 0, @WideStr);
|
QtDC.font.Metrics.boundingRect(@R1, @R, 0, @WideStr);
|
||||||
@ -2242,9 +2238,9 @@ begin
|
|||||||
if Options and ETO_RTLREADING <> 0 then
|
if Options and ETO_RTLREADING <> 0 then
|
||||||
QPainter_setLayoutDirection(QtDC.Widget, QtRightToLeft);
|
QPainter_setLayoutDirection(QtDC.Widget, QtRightToLeft);
|
||||||
if Count >= 0 then
|
if Count >= 0 then
|
||||||
WideStr := GetUtf8String(Copy(Str, 1, Count))
|
WideStr := {%H-}Copy(Str, 1, Count)
|
||||||
else
|
else
|
||||||
WideStr := GetUtf8String(Str);
|
WideStr := Str;
|
||||||
|
|
||||||
if (Options and ETO_CLIPPED <> 0) then
|
if (Options and ETO_CLIPPED <> 0) then
|
||||||
begin
|
begin
|
||||||
@ -4217,7 +4213,7 @@ begin
|
|||||||
if Str = nil then
|
if Str = nil then
|
||||||
AStr := ''
|
AStr := ''
|
||||||
else
|
else
|
||||||
AStr := GetUtf8String(Str);
|
AStr := Str;
|
||||||
Size.cx := 0;
|
Size.cx := 0;
|
||||||
Size.cY := Font.Metrics.Height;
|
Size.cY := Font.Metrics.Height;
|
||||||
if (AStr = '') then
|
if (AStr = '') then
|
||||||
@ -4304,7 +4300,7 @@ begin
|
|||||||
Size.cy := 0;
|
Size.cy := 0;
|
||||||
if (Count <= 0) or (Str = nil) or (StrPas(Str) = '') then
|
if (Count <= 0) or (Str = nil) or (StrPas(Str) = '') then
|
||||||
exit;
|
exit;
|
||||||
WideStr := GetUtf8String(Str);
|
WideStr := {%H-}Str;
|
||||||
{$warning fixme Qt6}
|
{$warning fixme Qt6}
|
||||||
Size.cx := QtDC.Metrics.width(@WideStr, Count);
|
Size.cx := QtDC.Metrics.width(@WideStr, Count);
|
||||||
Size.cy := QtDC.Metrics.height;
|
Size.cy := QtDC.Metrics.height;
|
||||||
@ -4552,6 +4548,7 @@ begin
|
|||||||
|
|
||||||
if (TQtWidget(Handle) is TQtMainWindow) and (not TQtMainWindow(Handle).IsMdiChild) then
|
if (TQtWidget(Handle) is TQtMainWindow) and (not TQtMainWindow(Handle).IsMdiChild) then
|
||||||
begin
|
begin
|
||||||
|
ARect := Rect(0,0,0,0);
|
||||||
GetClientRect(Handle, ARect);
|
GetClientRect(Handle, ARect);
|
||||||
Width := ARect.Width;
|
Width := ARect.Width;
|
||||||
Height := ARect.Height;
|
Height := ARect.Height;
|
||||||
@ -5228,8 +5225,8 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
Str := GetUtf8String(lpText);
|
Str := lpText;
|
||||||
TitleStr := GetUtf8String(lpCaption);
|
TitleStr := lpCaption;
|
||||||
//TODO: TRANSLATIONS for buttons text, use TQtMessageBox
|
//TODO: TRANSLATIONS for buttons text, use TQtMessageBox
|
||||||
if HWND <> 0 then
|
if HWND <> 0 then
|
||||||
AParent := TQtWidget(Hwnd).Widget
|
AParent := TQtWidget(Hwnd).Widget
|
||||||
@ -7250,9 +7247,9 @@ begin
|
|||||||
if not IsValidDC(DC) then Exit;
|
if not IsValidDC(DC) then Exit;
|
||||||
|
|
||||||
if Count >= 0 then
|
if Count >= 0 then
|
||||||
WideStr := GetUtf8String(Copy(Str, 1, Count))
|
WideStr := {%H-}Copy(Str, 1, Count)
|
||||||
else
|
else
|
||||||
WideStr := GetUtf8String(Str);
|
WideStr := Str;
|
||||||
|
|
||||||
TQtDeviceContext(DC).drawText(X, Y, @WideStr);
|
TQtDeviceContext(DC).drawText(X, Y, @WideStr);
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ begin
|
|||||||
ClearPanels(Widget);
|
ClearPanels(Widget);
|
||||||
if AStatusBar.SimplePanel then
|
if AStatusBar.SimplePanel then
|
||||||
begin
|
begin
|
||||||
Str := GetUtf8String(AStatusBar.SimpleText);
|
Str := AStatusBar{%H-}.SimpleText;
|
||||||
Widget.showMessage(@Str);
|
Widget.showMessage(@Str);
|
||||||
end else
|
end else
|
||||||
if AStatusBar.Panels.Count > 0 then
|
if AStatusBar.Panels.Count > 0 then
|
||||||
@ -580,7 +580,7 @@ begin
|
|||||||
SetLength(Widget.Panels, AStatusBar.Panels.Count);
|
SetLength(Widget.Panels, AStatusBar.Panels.Count);
|
||||||
for i := 0 to AStatusBar.Panels.Count - 1 do
|
for i := 0 to AStatusBar.Panels.Count - 1 do
|
||||||
begin
|
begin
|
||||||
Str := GetUtf8String(AStatusBar.Panels[i].Text);
|
Str := AStatusBar{%H-}.Panels[i].Text;
|
||||||
Widget.Panels[i] := TQtStatusBarPanel.CreateFrom(AStatusBar,
|
Widget.Panels[i] := TQtStatusBarPanel.CreateFrom(AStatusBar,
|
||||||
QLabel_create(@Str, Widget.Widget));
|
QLabel_create(@Str, Widget.Widget));
|
||||||
Widget.Panels[i].HasPaint := AStatusBar.Panels[i].Style = psOwnerDraw;
|
Widget.Panels[i].HasPaint := AStatusBar.Panels[i].Style = psOwnerDraw;
|
||||||
@ -633,7 +633,7 @@ begin
|
|||||||
if AStatusBar.SimplePanel then
|
if AStatusBar.SimplePanel then
|
||||||
begin
|
begin
|
||||||
ClearPanels(QtStatusBar);
|
ClearPanels(QtStatusBar);
|
||||||
Str := GetUtf8String(AStatusBar.SimpleText);
|
Str := AStatusBar{%H-}.SimpleText;
|
||||||
QtStatusBar.showMessage(@Str);
|
QtStatusBar.showMessage(@Str);
|
||||||
end else
|
end else
|
||||||
if AStatusBar.Panels.Count > 0 then
|
if AStatusBar.Panels.Count > 0 then
|
||||||
@ -643,7 +643,7 @@ begin
|
|||||||
if (PanelIndex >= Low(QtStatusBar.Panels)) and
|
if (PanelIndex >= Low(QtStatusBar.Panels)) and
|
||||||
(PanelIndex <= High(QtStatusBar.Panels)) then
|
(PanelIndex <= High(QtStatusBar.Panels)) then
|
||||||
begin
|
begin
|
||||||
Str := GetUtf8String(AStatusBar.Panels[PanelIndex].Text);
|
Str := AStatusBar{%H-}.Panels[PanelIndex].Text;
|
||||||
QLabel_setText(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), @Str);
|
QLabel_setText(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), @Str);
|
||||||
QLabel_setAlignment(QLabelH(QtStatusBar.Panels[PanelIndex].Widget),
|
QLabel_setAlignment(QLabelH(QtStatusBar.Panels[PanelIndex].Widget),
|
||||||
AlignmentToQtAlignmentMap[AStatusBar.Panels[PanelIndex].Alignment]);
|
AlignmentToQtAlignmentMap[AStatusBar.Panels[PanelIndex].Alignment]);
|
||||||
@ -663,14 +663,14 @@ begin
|
|||||||
QtStatusBar := TQtStatusBar(AStatusBar.Handle);
|
QtStatusBar := TQtStatusBar(AStatusBar.Handle);
|
||||||
if AStatusBar.SimplePanel then
|
if AStatusBar.SimplePanel then
|
||||||
begin
|
begin
|
||||||
Str := GetUtf8String(AStatusBar.SimpleText);
|
Str := AStatusBar{%H-}.SimpleText;
|
||||||
QtStatusBar.showMessage(@Str);
|
QtStatusBar.showMessage(@Str);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
if (PanelIndex >= Low(QtStatusBar.Panels)) and
|
if (PanelIndex >= Low(QtStatusBar.Panels)) and
|
||||||
(PanelIndex <= High(QtStatusBar.Panels)) then
|
(PanelIndex <= High(QtStatusBar.Panels)) then
|
||||||
begin
|
begin
|
||||||
Str := GetUtf8String(AStatusBar.Panels[PanelIndex].Text);
|
Str := AStatusBar{%H-}.Panels[PanelIndex].Text;
|
||||||
QLabel_setText(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), @Str);
|
QLabel_setText(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), @Str);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -815,7 +815,7 @@ begin
|
|||||||
TWIChild := QTreeWidgetItem_create(Ord(QTreeWidgetItemType));
|
TWIChild := QTreeWidgetItem_create(Ord(QTreeWidgetItemType));
|
||||||
QTreeWidgetItem_setFlags(TWIChild, QtItemIsEnabled);
|
QTreeWidgetItem_setFlags(TWIChild, QtItemIsEnabled);
|
||||||
QTreeWidgetItem_addChild(TWI, TWIChild);
|
QTreeWidgetItem_addChild(TWI, TWIChild);
|
||||||
Str := GetUtf8String(ALV.Column[AIndex].Caption);
|
Str := ALV{%H-}.Column[AIndex].Caption;
|
||||||
QTreeWidgetItem_setText(TWI, AIndex, @Str);
|
QTreeWidgetItem_setText(TWI, AIndex, @Str);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -990,7 +990,7 @@ begin
|
|||||||
TWI := QtTreeWidget.headerItem;
|
TWI := QtTreeWidget.headerItem;
|
||||||
if TWI <> NiL then
|
if TWI <> NiL then
|
||||||
begin
|
begin
|
||||||
Str := GetUtf8String(ACaption);
|
Str := {%H-}ACaption;
|
||||||
QTreeWidgetItem_setText(TWI, AIndex, @Str);
|
QTreeWidgetItem_setText(TWI, AIndex, @Str);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1524,7 +1524,7 @@ begin
|
|||||||
QtTreeWidget := TQtTreeWidget(ALV.Handle);
|
QtTreeWidget := TQtTreeWidget(ALV.Handle);
|
||||||
TWI := QTreeWidgetItem_create(Ord(QTreeWidgetItemType));
|
TWI := QTreeWidgetItem_create(Ord(QTreeWidgetItemType));
|
||||||
if AItem.Caption <> '' then
|
if AItem.Caption <> '' then
|
||||||
Str := GetUtf8String(AItem.Caption)
|
Str := AItem{%H-}.Caption
|
||||||
else
|
else
|
||||||
Str := '';
|
Str := '';
|
||||||
|
|
||||||
@ -1552,7 +1552,7 @@ begin
|
|||||||
AAlignment := AlignmentToQtAlignmentMap[ALV.Column[i + 1].Alignment] or QtAlignVCenter;
|
AAlignment := AlignmentToQtAlignmentMap[ALV.Column[i + 1].Alignment] or QtAlignVCenter;
|
||||||
if AItem.Subitems.Strings[i] <> '' then
|
if AItem.Subitems.Strings[i] <> '' then
|
||||||
begin
|
begin
|
||||||
Str := GetUtf8String(AItem.Subitems.Strings[i]);
|
Str := AItem{%H-}.Subitems.Strings[i];
|
||||||
QtTreeWidget.setItemText(TWI, i + 1, Str, AAlignment);
|
QtTreeWidget.setItemText(TWI, i + 1, Str, AAlignment);
|
||||||
QtTreeWidget.setItemData(TWI, i + 1, AItem);
|
QtTreeWidget.setItemData(TWI, i + 1, AItem);
|
||||||
end;
|
end;
|
||||||
@ -1594,7 +1594,7 @@ begin
|
|||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
QtTreeWidget := TQtTreeWidget(ALV.Handle);
|
QtTreeWidget := TQtTreeWidget(ALV.Handle);
|
||||||
Str := GetUtf8String(AText);
|
Str := {%H-}AText;
|
||||||
TWI := QtTreeWidget.topLevelItem(AIndex);
|
TWI := QtTreeWidget.topLevelItem(AIndex);
|
||||||
if TWI <> NiL then
|
if TWI <> NiL then
|
||||||
begin
|
begin
|
||||||
@ -2075,7 +2075,7 @@ begin
|
|||||||
for i := 0 to AList.Items.Count - 1 do
|
for i := 0 to AList.Items.Count - 1 do
|
||||||
begin
|
begin
|
||||||
AItem := AList.Items[i];
|
AItem := AList.Items[i];
|
||||||
WStr := GetUTF8String(AItem.Caption);
|
WStr := AItem{%H-}.Caption;
|
||||||
Item := QtTreeWidget.topLevelItem(i);
|
Item := QtTreeWidget.topLevelItem(i);
|
||||||
QtTreeWidget.setItemText(Item, 0, WStr, AlignmentToQtAlignmentMap[AList.Column[0].Alignment]);
|
QtTreeWidget.setItemText(Item, 0, WStr, AlignmentToQtAlignmentMap[AList.Column[0].Alignment]);
|
||||||
QtTreeWidget.setItemData(Item, 0, AItem);
|
QtTreeWidget.setItemData(Item, 0, AItem);
|
||||||
@ -2113,7 +2113,7 @@ begin
|
|||||||
AAlignment := QtAlignLeft;
|
AAlignment := QtAlignLeft;
|
||||||
if (TCustomListViewHack(AList).Columns.Count > 0) and (j + 1 < TCustomListViewHack(AList).Columns.Count) then
|
if (TCustomListViewHack(AList).Columns.Count > 0) and (j + 1 < TCustomListViewHack(AList).Columns.Count) then
|
||||||
AAlignment := AlignmentToQtAlignmentMap[TCustomListViewHack(AList).Column[j + 1].Alignment];
|
AAlignment := AlignmentToQtAlignmentMap[TCustomListViewHack(AList).Column[j + 1].Alignment];
|
||||||
WStr := GetUtf8String(AItem.Subitems.Strings[j]);
|
WStr := AItem{%H-}.Subitems.Strings[j];
|
||||||
QtTreeWidget.setItemText(Item, j + 1, WStr, AAlignment);
|
QtTreeWidget.setItemText(Item, j + 1, WStr, AAlignment);
|
||||||
QtTreeWidget.setItemData(Item, j + 1, AItem);
|
QtTreeWidget.setItemData(Item, j + 1, AItem);
|
||||||
end;
|
end;
|
||||||
|
@ -360,7 +360,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
Wdgt := TQtWidget(AWinControl.Handle);
|
Wdgt := TQtWidget(AWinControl.Handle);
|
||||||
Wdgt.BeginUpdate;
|
Wdgt.BeginUpdate;
|
||||||
Wdgt.setText(GetUtf8String(AText));
|
Wdgt.setText(AText{%H-});
|
||||||
Wdgt.EndUpdate;
|
Wdgt.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -284,10 +284,10 @@ begin
|
|||||||
// Remember that AFileDialog.FilterIndex is a 1-based index and that
|
// Remember that AFileDialog.FilterIndex is a 1-based index and that
|
||||||
// List has a zero-based index
|
// List has a zero-based index
|
||||||
if (AFileDialog.FilterIndex > 0) and (List.Count >= AFileDialog.FilterIndex) then
|
if (AFileDialog.FilterIndex > 0) and (List.Count >= AFileDialog.FilterIndex) then
|
||||||
ASelectedFilter := GetUTF8String(List.Strings[AFileDialog.FilterIndex - 1])
|
ASelectedFilter := List{%H-}.Strings[AFileDialog.FilterIndex - 1]
|
||||||
else
|
else
|
||||||
if (List.Count > 0) then
|
if (List.Count > 0) then
|
||||||
ASelectedFilter := GetUTF8String(List.Strings[0]);
|
ASelectedFilter := List{%H-}.Strings[0];
|
||||||
|
|
||||||
finally
|
finally
|
||||||
List.Free;
|
List.Free;
|
||||||
@ -296,7 +296,7 @@ begin
|
|||||||
if (AFileDialog is TSaveDialog) and (trim(TmpFilter)='()') then
|
if (AFileDialog is TSaveDialog) and (trim(TmpFilter)='()') then
|
||||||
Result := ''
|
Result := ''
|
||||||
else
|
else
|
||||||
Result := GetUtf8String(TmpFilter);
|
Result := {%H-}TmpFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TQtWSFileDialog.UpdateProperties(
|
class procedure TQtWSFileDialog.UpdateProperties(
|
||||||
@ -308,7 +308,7 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
ATitle := GetUtf8String(AFileDialog.Title);
|
ATitle := AFileDialog{%H-}.Title;
|
||||||
QtFileDialog.setWindowTitle(@ATitle);
|
QtFileDialog.setWindowTitle(@ATitle);
|
||||||
|
|
||||||
{$ifndef QT_NATIVE_DIALOGS}
|
{$ifndef QT_NATIVE_DIALOGS}
|
||||||
@ -359,7 +359,7 @@ begin
|
|||||||
if (AFileDialog.FileName <> '') and
|
if (AFileDialog.FileName <> '') and
|
||||||
not DirectoryExistsUTF8(AFileDialog.FileName) then
|
not DirectoryExistsUTF8(AFileDialog.FileName) then
|
||||||
begin
|
begin
|
||||||
ATitle := GetUTF8String(AFileDialog.FileName);
|
ATitle := AFileDialog{%H-}.FileName;
|
||||||
if (AFileDialog is TSaveDialog) or FileExistsUTF8(AFileDialog.FileName) then
|
if (AFileDialog is TSaveDialog) or FileExistsUTF8(AFileDialog.FileName) then
|
||||||
QFileDialog_selectFile(QFileDialogH(QtFileDialog.Widget), @ATitle);
|
QFileDialog_selectFile(QFileDialogH(QtFileDialog.Widget), @ATitle);
|
||||||
{$ifndef QT_NATIVE_DIALOGS}
|
{$ifndef QT_NATIVE_DIALOGS}
|
||||||
@ -684,7 +684,7 @@ var
|
|||||||
AInitDir: WideString;
|
AInitDir: WideString;
|
||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
ATitle := GetUtf8String(AFileDialog.Title);
|
ATitle := AFileDialog{%H-}.Title;
|
||||||
QtFileDialog.setWindowTitle(@ATitle);
|
QtFileDialog.setWindowTitle(@ATitle);
|
||||||
{$ifndef QT_NATIVE_DIALOGS}
|
{$ifndef QT_NATIVE_DIALOGS}
|
||||||
s := AFileDialog.InitialDir;
|
s := AFileDialog.InitialDir;
|
||||||
@ -700,7 +700,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if not DirectoryExistsUTF8(S) then
|
if not DirectoryExistsUTF8(S) then
|
||||||
S := GetCurrentDirUTF8;
|
S := GetCurrentDirUTF8;
|
||||||
QtFileDialog.setDirectory(GetUTF8String(s));
|
QtFileDialog.setDirectory(S{%H-});
|
||||||
{$else}
|
{$else}
|
||||||
S := AFileDialog.InitialDir;
|
S := AFileDialog.InitialDir;
|
||||||
if not DirectoryExistsUTF8(S) then
|
if not DirectoryExistsUTF8(S) then
|
||||||
|
@ -209,7 +209,7 @@ begin
|
|||||||
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
|
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
|
||||||
QtGroupBox.GroupBoxType := tgbtRadioGroup;
|
QtGroupBox.GroupBoxType := tgbtRadioGroup;
|
||||||
|
|
||||||
Str := GetUtf8String(AWinControl.Caption);
|
Str := AWinControl{%H-}.Caption;
|
||||||
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
|
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
|
||||||
|
|
||||||
QtGroupBox.AttachEvents;
|
QtGroupBox.AttachEvents;
|
||||||
@ -235,7 +235,7 @@ begin
|
|||||||
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
|
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
|
||||||
QtGroupBox.GroupBoxType := tgbtCheckGroup;
|
QtGroupBox.GroupBoxType := tgbtCheckGroup;
|
||||||
|
|
||||||
Str := GetUtf8String(AWinControl.Caption);
|
Str := AWinControl{%H-}.Caption;
|
||||||
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
|
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
|
||||||
|
|
||||||
QtGroupBox.AttachEvents;
|
QtGroupBox.AttachEvents;
|
||||||
|
@ -205,7 +205,7 @@ begin
|
|||||||
QtMainWindow.QtFormBorderStyle := Ord(AForm.BorderStyle);
|
QtMainWindow.QtFormBorderStyle := Ord(AForm.BorderStyle);
|
||||||
QtMainWindow.QtFormStyle := Ord(AForm.FormStyle);
|
QtMainWindow.QtFormStyle := Ord(AForm.FormStyle);
|
||||||
|
|
||||||
Str := GetUtf8String(AWinControl.Caption);
|
Str := AWinControl{%H-}.Caption;
|
||||||
|
|
||||||
QtMainWindow.SetWindowTitle(@Str);
|
QtMainWindow.SetWindowTitle(@Str);
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ begin
|
|||||||
Result.setHasSubmenu(AMenuItem.Count > 0);
|
Result.setHasSubmenu(AMenuItem.Count > 0);
|
||||||
if not AMenuItem.IsLine then
|
if not AMenuItem.IsLine then
|
||||||
begin
|
begin
|
||||||
Result.setText(GetUtf8String(AMenuItem.Caption));
|
Result.setText(AMenuItem.Caption{%H-});
|
||||||
Result.setEnabled(AMenuItem.Enabled);
|
Result.setEnabled(AMenuItem.Enabled);
|
||||||
|
|
||||||
{issue #37741}
|
{issue #37741}
|
||||||
@ -283,7 +283,7 @@ begin
|
|||||||
if ACaption = cLineCaption then
|
if ACaption = cLineCaption then
|
||||||
TQtMenu(Widget).setText('')
|
TQtMenu(Widget).setText('')
|
||||||
else
|
else
|
||||||
TQtMenu(Widget).setText(GetUtf8String(ACaption));
|
TQtMenu(Widget).setText(ACaption{%H-});
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(ACustomMemo, 'AppendText') or (Length(AText) = 0) then
|
if not WSCheckHandleAllocated(ACustomMemo, 'AppendText') or (Length(AText) = 0) then
|
||||||
Exit;
|
Exit;
|
||||||
AStr := GetUtf8String(AText);
|
AStr := {%H-}AText;
|
||||||
TQtTextEdit(ACustomMemo.Handle).BeginUpdate;
|
TQtTextEdit(ACustomMemo.Handle).BeginUpdate;
|
||||||
TQtTextEdit(ACustomMemo.Handle).Append(AStr);
|
TQtTextEdit(ACustomMemo.Handle).Append(AStr);
|
||||||
TQtTextEdit(ACustomMemo.Handle).EndUpdate;
|
TQtTextEdit(ACustomMemo.Handle).EndUpdate;
|
||||||
@ -1390,7 +1390,7 @@ begin
|
|||||||
Text := TCustomComboBox(AWinControl).Text;
|
Text := TCustomComboBox(AWinControl).Text;
|
||||||
QtComboBox.FList.Assign(TCustomComboBox(AWinControl).Items);
|
QtComboBox.FList.Assign(TCustomComboBox(AWinControl).Items);
|
||||||
QtComboBox.setCurrentIndex(ItemIndex);
|
QtComboBox.setCurrentIndex(ItemIndex);
|
||||||
QtComboBox.setText(GetUTF8String(Text));
|
QtComboBox.setText(Text{%H-});
|
||||||
QtComboBox.setEditable((AParams.Style and CBS_DROPDOWN <> 0) or
|
QtComboBox.setEditable((AParams.Style and CBS_DROPDOWN <> 0) or
|
||||||
(AParams.Style and CBS_SIMPLE <> 0));
|
(AParams.Style and CBS_SIMPLE <> 0));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user