diff --git a/lcl/interfaces/qt5/qtobject.inc b/lcl/interfaces/qt5/qtobject.inc index c4bbc057b7..b2456aedf8 100644 --- a/lcl/interfaces/qt5/qtobject.inc +++ b/lcl/interfaces/qt5/qtobject.inc @@ -504,7 +504,7 @@ procedure TQtWidgetSet.AppSetTitle(const ATitle: string); var W: WideString; begin - W := GetUtf8String(ATitle); + W := {%H-}ATitle; QCoreApplication_setApplicationName(@W); end; diff --git a/lcl/interfaces/qt5/qtobjects.pas b/lcl/interfaces/qt5/qtobjects.pas index e52a2a3328..fb5900369a 100644 --- a/lcl/interfaces/qt5/qtobjects.pas +++ b/lcl/interfaces/qt5/qtobjects.pas @@ -1674,7 +1674,7 @@ procedure TQtFont.setRawName(p1: string); var Str: WideString; begin - Str := GetUtf8String(p1); + Str := {%H-}p1; QFont_setRawName(FHandle, @Str); end; @@ -1683,7 +1683,7 @@ procedure TQtFont.setFamily(p1: string); var Str: WideString; begin - Str := GetUtf8String(p1); + Str := {%H-}p1; QFont_setFamily(FHandle, @Str); end; @@ -4795,7 +4795,7 @@ procedure TQtStringList.Insert(Index: Integer; const S: string); var W: WideString; begin - W := GetUtf8String(S); + W := {%H-}S; QStringList_insert(FHandle, Index, @W); end; diff --git a/lcl/interfaces/qt5/qtpagecontrol.inc b/lcl/interfaces/qt5/qtpagecontrol.inc index 21dcbb8614..87487148c2 100644 --- a/lcl/interfaces/qt5/qtpagecontrol.inc +++ b/lcl/interfaces/qt5/qtpagecontrol.inc @@ -298,8 +298,7 @@ begin QtTabWidget.setUpdatesEnabled(False); QtTabWidget.BeginUpdate; try - QtTabWidget.insertTab(AIndex, TQtPage(AChild.Handle).Widget, - GetUtf8String(AChild.Caption)); + QtTabWidget.insertTab(AIndex, TQtPage(AChild.Handle).Widget, AChild.Caption{%H-}); finally QtTabWidget.EndUpdate; QtTabWidget.setUpdatesEnabled(True); @@ -489,7 +488,7 @@ begin Index := AChild.PageIndex; if Index < 0 then Index := ATabControl.IndexOf(AChild); - TQtTabWidget(ATabControl.Handle).setTabText(Index, GetUtf8String(AText)); + TQtTabWidget(ATabControl.Handle).setTabText(Index, AText{%H-}); end; class procedure TQtWSCustomTabControl.SetTabPosition( diff --git a/lcl/interfaces/qt5/qtprivate.pp b/lcl/interfaces/qt5/qtprivate.pp index 9a6c3309ce..f414ea65ad 100644 --- a/lcl/interfaces/qt5/qtprivate.pp +++ b/lcl/interfaces/qt5/qtprivate.pp @@ -170,7 +170,7 @@ begin TextEdit := TQtTextEdit(FOwner.Handle); if ABlockSignals then TextEdit.BeginUpdate; - W := GetUtf8String(AStr); + W := AStr; if AClear then begin // never trigger changed signal when clearing text here. @@ -268,16 +268,13 @@ begin end; procedure TQtMemoStrings.Put(Index: Integer; const S: string); -var - W: WideString; begin {$ifdef VerboseQtMemoStrings} WriteLn('TQtMemoStrings.Put Index=',Index,' S=',S); {$endif} if FTextChanged then InternalUpdate; FStringList[Index] := S; - W := GetUTF8String(S); - TQtTextEdit(FOwner.Handle).setLineText(Index, W); + TQtTextEdit(FOwner.Handle).setLineText(Index, S{%H-}); end; procedure TQtMemoStrings.SetTextStr(const Value: string); @@ -288,7 +285,7 @@ begin WriteLn('TQtMemoStrings.SetTextStr Value=',Value); {$endif} SetInternalText(Value); - W := GetInternalText; + W := {%H-}GetInternalText; ExternalUpdate(W, True, False); FTextChanged := False; end; @@ -349,7 +346,7 @@ begin {$endif} FStringList.Clear; SetInternalText(TStrings(Source).Text); - W := GetInternalText; + W := {%H-}GetInternalText; ExternalUpdate(W, True, False); FTextChanged := False; exit; @@ -432,9 +429,9 @@ begin begin Index := FStringList.Add(S); if FHasTrailingLineBreak then - W := GetUTF8String(S + LineBreak) + W := UTF8ToUTF16(S + LineBreak) else - W := GetUTF8String(S); + W := UTF8ToUTF16(S); if FHasTrailingLineBreak then begin //issue #39444 @@ -452,7 +449,7 @@ begin end else begin FStringList.Insert(Index, S); - W := GetUTF8String(S); + W := UTF8ToUTF16(S); TQtTextEdit(FOwner.Handle).insertLine(Index, W); end; FTextChanged := False; // FStringList is already updated, no need to update from WS. diff --git a/lcl/interfaces/qt5/qtproc.pp b/lcl/interfaces/qt5/qtproc.pp index 20ac6fc583..1a252a33d6 100644 --- a/lcl/interfaces/qt5/qtproc.pp +++ b/lcl/interfaces/qt5/qtproc.pp @@ -47,7 +47,6 @@ type procedure FillStandardDescription(var Desc: TRawImageDescription); function GetPixelsPerInch: Integer; -function GetUtf8String(const S: String): WideString; implementation @@ -92,13 +91,6 @@ begin // Desc.MaskShift := 0; end; -function GetUtf8String(const S: String): WideString; -begin - Result := UTF8ToUTF16(S); - if Result = '' then - Result := S; -end; - {------------------------------------------------------------------------------ Function: GetPixelsPerInch Params: none diff --git a/lcl/interfaces/qt5/qtsystemtrayicon.pas b/lcl/interfaces/qt5/qtsystemtrayicon.pas index c741bc6515..b2e8d7c9b6 100644 --- a/lcl/interfaces/qt5/qtsystemtrayicon.pas +++ b/lcl/interfaces/qt5/qtsystemtrayicon.pas @@ -340,8 +340,8 @@ var WHint: WideString; WTitle: WideString; begin - WHint := GetUTF8String(AHint); - WTitle := GetUTF8String(ATitle); + WHint := {%H-}AHint; + WTitle := {%H-}ATitle; QSystemTrayIcon_showMessage(QSystemTrayIconH(TheObject), @WTitle, @WHint, AFlag, ATimeOut); end; diff --git a/lcl/interfaces/qt5/qtthemes.pas b/lcl/interfaces/qt5/qtthemes.pas index 785fa47357..a8b5298670 100644 --- a/lcl/interfaces/qt5/qtthemes.pas +++ b/lcl/interfaces/qt5/qtthemes.pas @@ -614,7 +614,7 @@ begin case Details.Element of teToolTip: begin - W := GetUTF8String(S); + W := {%H-}S; Context.save; AOldMode := Context.SetBkMode(TRANSPARENT); try @@ -658,7 +658,7 @@ begin exit; end; - W := GetUTF8String(S); + W := {%H-}S; Context.save; try Context.SetBkMode(TRANSPARENT); @@ -709,7 +709,7 @@ begin else begin // default text drawing for all ! - W := GetUTF8String(S); + W := {%H-}S; Context.save; AOldMode := Context.SetBkMode(TRANSPARENT); if Context.Parent <> nil then diff --git a/lcl/interfaces/qt5/qtwidgets.pas b/lcl/interfaces/qt5/qtwidgets.pas index 52880d6d63..b5f407381a 100644 --- a/lcl/interfaces/qt5/qtwidgets.pas +++ b/lcl/interfaces/qt5/qtwidgets.pas @@ -3048,7 +3048,7 @@ begin SetLength(Files, FilesList.Count); for i := 0 to High(Files) do begin - WStr := GetUTF8String(FilesList.Strings[i]); + WStr := FilesList{%H-}.Strings[i]; Url := QUrl_create(@WStr); QUrl_toLocalFile(Url, @WStr); Files[i] := UTF16ToUTF8(WStr); @@ -11302,7 +11302,7 @@ procedure TQtComboBox.insertItem(AIndex: Integer; AText: String); var Str: WideString; begin - Str := GetUtf8String(AText); + Str := {%H-}AText; insertItem(AIndex, @Str); end; @@ -11368,7 +11368,7 @@ var begin if (AIndex >= 0) and (AIndex < QComboBox_count(QComboBoxH(Widget))) then begin - Str := GetUTF8String(AText); + Str := {%H-}AText; QComboBox_setItemText(QComboBoxH(Widget), AIndex, @Str); {we must update our custom delegate} if (FDropList <> nil) and @@ -12652,7 +12652,7 @@ begin end; end; - WStr := GetUTF8String(TCustomListViewHack(LCLObject).Items[TopItem].Caption); + WStr := TCustomListViewHack(LCLObject){%H-}.Items[TopItem].Caption; // reduce paint overhead by checking text v := QVariant_create(); @@ -13564,7 +13564,7 @@ procedure TQtListWidget.insertItem(AIndex: Integer; AText: String); var Str: WideString; begin - Str := GetUtf8String(AText); + Str := {%H-}AText; insertItem(AIndex, @Str); end; @@ -13717,7 +13717,7 @@ var Str: WideString; R: TRect; begin - Str := GetUTF8String(AText); + Str := {%H-}AText; if (AIndex >= 0) and (AIndex < rowCount) then begin Item := getItem(AIndex); @@ -13739,7 +13739,7 @@ var Str: WideString; R: TRect; begin - Str := GetUTF8String(AText); + Str := {%H-}AText; if (AIndex >= 0) and (AIndex < rowCount) then begin Item := getItem(AIndex); @@ -14785,7 +14785,7 @@ begin if (TopItem < 0) or (TopItem > TCustomListViewHack(LCLObject).Items.Count - 1) then continue; - WStr := GetUTF8String(TCustomListViewHack(LCLObject).Items[TopItem].Caption); + WStr := TCustomListViewHack(LCLObject){%H-}.Items[TopItem].Caption; ASelected := TCustomListViewHack(LCLObject).Items[TopItem].Selected; v := QVariant_create(PWideString(@WStr)); @@ -14907,7 +14907,7 @@ begin itemChild := QTreeWidgetItem_child(item, j); if itemChild <> nil then begin - WStr := GetUTF8String(TCustomListViewHack(LCLObject).Items[TopItem].SubItems[j]); + WStr := TCustomListViewHack(LCLObject){%H-}.Items[TopItem].SubItems[j]; v := QVariant_create(PWideString(@WStr)); v2 := QVariant_create; try @@ -14927,7 +14927,7 @@ begin begin for j := 0 to TCustomListViewHack(LCLObject).Items[TopItem].SubItems.Count - 1 do begin - WStr := GetUTF8String(TCustomListViewHack(LCLObject).Items[TopItem].SubItems[j]); + WStr := TCustomListViewHack(LCLObject){%H-}.Items[TopItem].SubItems[j]; v := QVariant_create(PWideString(@WStr)); QTreeWidgetItem_setData(item, j + 1, Ord(QtDisplayRole), v); @@ -17446,7 +17446,7 @@ var WStr: WideString; begin inherited InitializeAccessibility; - WStr := GetUtf8String(ClassName+':ViewPort'); + WStr := UTF8ToUTF16(ClassName+':ViewPort'); QWidget_setAccessibleName(viewPortWidget, @WStr); end; @@ -19342,7 +19342,7 @@ begin try for i := 0 to AList.Count - 1 do begin - WStr := GetUTF8String(AList.Strings[i]); + WStr := AList{%H-}.Strings[i]; QStringList_append(List, @WStr); end; QFileDialog_setHistory(QFileDialogH(Widget), List); diff --git a/lcl/interfaces/qt5/qtwinapi.inc b/lcl/interfaces/qt5/qtwinapi.inc index b3949289ba..adf525831f 100644 --- a/lcl/interfaces/qt5/qtwinapi.inc +++ b/lcl/interfaces/qt5/qtwinapi.inc @@ -1371,9 +1371,9 @@ begin QtDC :=TQtDeviceContext(DC); if Count >= 0 then - WideStr := GetUtf8String(Copy(Str, 1, Count)) + WideStr := {%H-}Copy(Str, 1, Count) else - WideStr := GetUtf8String(Str); + WideStr := Str; ClipRect := Rect(0, 0, 0, 0); B := QtDC.getClipping; @@ -2191,16 +2191,12 @@ var while CurCount > 0 do begin CharLen := UTF8CodepointSize(CurStr); + W := {%H-}Copy(CurStr, 1, CharLen); if AClipped then - begin - W := GetUTF8String(Copy(CurStr, 1, CharLen)); QtDC.drawText(CurX, Y, Rect^.Right - Rect^.Left, Rect^.Bottom - Rect^.Top, - QtTextDontClip, @W); - end else - begin - W := GetUTF8String(Copy(CurStr, 1, CharLen)); + QtTextDontClip, @W) + else QtDC.drawText(CurX, Y, @W); - end; inc(CurX, CurDx^); inc(CurDx); inc(CurStr, CharLen); @@ -2221,9 +2217,9 @@ begin if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then begin if Count >= 0 then - WideStr := GetUtf8String(Copy(Str, 1, Count)) + WideStr := {%H-}Copy(Str, 1, Count) else - WideStr := GetUtf8String(Str); + WideStr := Str; R := QtDC.getClipRegion.getBoundingRect; QtDC.font.Metrics.boundingRect(@R1, @R, 0, @WideStr); @@ -2245,9 +2241,9 @@ begin if Options and ETO_RTLREADING <> 0 then QPainter_setLayoutDirection(QtDC.Widget, QtRightToLeft); if Count >= 0 then - WideStr := GetUtf8String(Copy(Str, 1, Count)) + WideStr := {%H-}Copy(Str, 1, Count) else - WideStr := GetUtf8String(Str); + WideStr := Str; if (Options and ETO_CLIPPED <> 0) then begin @@ -4202,7 +4198,7 @@ begin if Str = nil then AStr := '' else - AStr := GetUtf8String(Str); + AStr := Str; Size.cx := 0; Size.cY := Font.Metrics.Height; if (AStr = '') then @@ -4285,7 +4281,7 @@ begin Size.cy := 0; if (Count <= 0) or (Str = nil) or (StrPas(Str) = '') then exit; - WideStr := GetUtf8String(Str); + WideStr := Str; Size.cx := QtDC.Metrics.width(@WideStr, Count); Size.cy := QtDC.Metrics.height; @@ -5218,8 +5214,8 @@ var {$ENDIF} begin Result := 0; - Str := GetUtf8String(lpText); - TitleStr := GetUtf8String(lpCaption); + Str := lpText; + TitleStr := lpCaption; //TODO: TRANSLATIONS for buttons text, use TQtMessageBox if HWND <> 0 then AParent := TQtWidget(Hwnd).Widget @@ -7210,9 +7206,9 @@ begin if not IsValidDC(DC) then Exit; if Count >= 0 then - WideStr := GetUtf8String(Copy(Str, 1, Count)) + WideStr := {%H-}Copy(Str, 1, Count) else - WideStr := GetUtf8String(Str); + WideStr := Str; TQtDeviceContext(DC).drawText(X, Y, @WideStr); diff --git a/lcl/interfaces/qt5/qtwscomctrls.pp b/lcl/interfaces/qt5/qtwscomctrls.pp index 99ef144084..3a0a85569c 100644 --- a/lcl/interfaces/qt5/qtwscomctrls.pp +++ b/lcl/interfaces/qt5/qtwscomctrls.pp @@ -573,7 +573,7 @@ begin ClearPanels(Widget); if AStatusBar.SimplePanel then begin - Str := GetUtf8String(AStatusBar.SimpleText); + Str := AStatusBar{%H-}.SimpleText; Widget.showMessage(@Str); end else if AStatusBar.Panels.Count > 0 then @@ -582,7 +582,7 @@ begin SetLength(Widget.Panels, AStatusBar.Panels.Count); for i := 0 to AStatusBar.Panels.Count - 1 do begin - Str := GetUtf8String(AStatusBar.Panels[i].Text); + Str := AStatusBar{%H-}.Panels[i].Text; Widget.Panels[i] := TQtStatusBarPanel.CreateFrom(AStatusBar, QLabel_create(@Str, Widget.Widget)); Widget.Panels[i].HasPaint := AStatusBar.Panels[i].Style = psOwnerDraw; @@ -635,7 +635,7 @@ begin if AStatusBar.SimplePanel then begin ClearPanels(QtStatusBar); - Str := GetUtf8String(AStatusBar.SimpleText); + Str := AStatusBar{%H-}.SimpleText; QtStatusBar.showMessage(@Str); end else if AStatusBar.Panels.Count > 0 then @@ -645,7 +645,7 @@ begin if (PanelIndex >= Low(QtStatusBar.Panels)) and (PanelIndex <= High(QtStatusBar.Panels)) then begin - Str := GetUtf8String(AStatusBar.Panels[PanelIndex].Text); + Str := AStatusBar{%H-}.Panels[PanelIndex].Text; QLabel_setText(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), @Str); QLabel_setAlignment(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), AlignmentToQtAlignmentMap[AStatusBar.Panels[PanelIndex].Alignment]); @@ -665,14 +665,14 @@ begin QtStatusBar := TQtStatusBar(AStatusBar.Handle); if AStatusBar.SimplePanel then begin - Str := GetUtf8String(AStatusBar.SimpleText); + Str := AStatusBar{%H-}.SimpleText; QtStatusBar.showMessage(@Str); end else begin if (PanelIndex >= Low(QtStatusBar.Panels)) and (PanelIndex <= High(QtStatusBar.Panels)) then begin - Str := GetUtf8String(AStatusBar.Panels[PanelIndex].Text); + Str := AStatusBar{%H-}.Panels[PanelIndex].Text; QLabel_setText(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), @Str); end; end; @@ -817,7 +817,7 @@ begin TWIChild := QTreeWidgetItem_create(Ord(QTreeWidgetItemType)); QTreeWidgetItem_setFlags(TWIChild, QtItemIsEnabled); QTreeWidgetItem_addChild(TWI, TWIChild); - Str := GetUtf8String(ALV.Column[AIndex].Caption); + Str := ALV{%H-}.Column[AIndex].Caption; QTreeWidgetItem_setText(TWI, AIndex, @Str); end; @@ -992,7 +992,7 @@ begin TWI := QtTreeWidget.headerItem; if TWI <> NiL then begin - Str := GetUtf8String(ACaption); + Str := {%H-}ACaption; QTreeWidgetItem_setText(TWI, AIndex, @Str); end; end; @@ -1526,7 +1526,7 @@ begin QtTreeWidget := TQtTreeWidget(ALV.Handle); TWI := QTreeWidgetItem_create(Ord(QTreeWidgetItemType)); if AItem.Caption <> '' then - Str := GetUtf8String(AItem.Caption) + Str := AItem{%H-}.Caption else Str := ''; @@ -1554,7 +1554,7 @@ begin AAlignment := AlignmentToQtAlignmentMap[ALV.Column[i + 1].Alignment] or QtAlignVCenter; if AItem.Subitems.Strings[i] <> '' then begin - Str := GetUtf8String(AItem.Subitems.Strings[i]); + Str := AItem{%H-}.Subitems.Strings[i]; QtTreeWidget.setItemText(TWI, i + 1, Str, AAlignment); QtTreeWidget.setItemData(TWI, i + 1, AItem); end; @@ -1596,7 +1596,7 @@ begin end else begin QtTreeWidget := TQtTreeWidget(ALV.Handle); - Str := GetUtf8String(AText); + Str := {%H-}AText; TWI := QtTreeWidget.topLevelItem(AIndex); if TWI <> NiL then begin @@ -2077,7 +2077,7 @@ begin for i := 0 to AList.Items.Count - 1 do begin AItem := AList.Items[i]; - WStr := GetUTF8String(AItem.Caption); + WStr := AItem{%H-}.Caption; Item := QtTreeWidget.topLevelItem(i); QtTreeWidget.setItemText(Item, 0, WStr, AlignmentToQtAlignmentMap[AList.Column[0].Alignment]); QtTreeWidget.setItemData(Item, 0, AItem); @@ -2115,7 +2115,7 @@ begin AAlignment := QtAlignLeft; if (TCustomListViewHack(AList).Columns.Count > 0) and (j + 1 < TCustomListViewHack(AList).Columns.Count) then 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.setItemData(Item, j + 1, AItem); end; diff --git a/lcl/interfaces/qt5/qtwscontrols.pp b/lcl/interfaces/qt5/qtwscontrols.pp index eeb91c2147..e3c3bb0b6e 100644 --- a/lcl/interfaces/qt5/qtwscontrols.pp +++ b/lcl/interfaces/qt5/qtwscontrols.pp @@ -362,7 +362,7 @@ begin Exit; Wdgt := TQtWidget(AWinControl.Handle); Wdgt.BeginUpdate; - Wdgt.setText(GetUtf8String(AText)); + Wdgt.setText(AText{%H-}); Wdgt.EndUpdate; end; diff --git a/lcl/interfaces/qt5/qtwsdialogs.pp b/lcl/interfaces/qt5/qtwsdialogs.pp index 5fc62812bc..c42406142b 100644 --- a/lcl/interfaces/qt5/qtwsdialogs.pp +++ b/lcl/interfaces/qt5/qtwsdialogs.pp @@ -284,10 +284,10 @@ begin // Remember that AFileDialog.FilterIndex is a 1-based index and that // List has a zero-based index 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 if (List.Count > 0) then - ASelectedFilter := GetUTF8String(List.Strings[0]); + ASelectedFilter := List{%H-}.Strings[0]; finally List.Free; @@ -296,7 +296,7 @@ begin if (AFileDialog is TSaveDialog) and (trim(TmpFilter)='()') then Result := '' else - Result := GetUtf8String(TmpFilter); + Result := {%H-}TmpFilter; end; class procedure TQtWSFileDialog.UpdateProperties( @@ -308,7 +308,7 @@ var {$ENDIF} s: String; begin - ATitle := GetUtf8String(AFileDialog.Title); + ATitle := AFileDialog{%H-}.Title; QtFileDialog.setWindowTitle(@ATitle); {$ifndef QT_NATIVE_DIALOGS} @@ -316,10 +316,10 @@ begin if UTF8Pos('$HOME', S) > 0 then begin {$IFDEF MSWINDOWS} - AInitDir := GetEnvironmentVariableUTF8('HOMEDRIVE') + + AInitDir := GetEnvironmentVariableUTF8('HOMEDRIVE') {%H-}+ GetEnvironmentVariableUTF8('HOMEPATH'); {$ELSE} - AInitDir := GetEnvironmentVariableUTF8('HOME'); + AInitDir := {%H-}GetEnvironmentVariableUTF8('HOME'); {$ENDIF} s := StringReplace(S,'$HOME', UTF8Encode(AInitDir),[rfReplaceAll]); end else @@ -327,7 +327,7 @@ begin S := GetCurrentDirUTF8; if not DirectoryExistsUTF8(S) then S := GetCurrentDirUTF8; - QtFileDialog.setDirectory(S); + QtFileDialog.setDirectory(S{%H-}); {$else} s := AFileDialog.InitialDir; if S = '' then @@ -359,7 +359,7 @@ begin if (AFileDialog.FileName <> '') and not DirectoryExistsUTF8(AFileDialog.FileName) then begin - ATitle := GetUTF8String(AFileDialog.FileName); + ATitle := AFileDialog{%H-}.FileName; if (AFileDialog is TSaveDialog) or FileExistsUTF8(AFileDialog.FileName) then QFileDialog_selectFile(QFileDialogH(QtFileDialog.Widget), @ATitle); {$ifndef QT_NATIVE_DIALOGS} @@ -521,7 +521,7 @@ begin FileDialog.FileName := UTF16ToUTF8(ReturnText); {$endif} end; - ReturnText := FileDialog.Files.Text; + ReturnText := FileDialog{%H-}.Files.Text; finally QStringList_destroy(ReturnList); end; @@ -631,7 +631,7 @@ begin FileDialog.FileName := UTF16ToUTF8(ReturnText); {$endif} end; - ReturnText := FileDialog.Files.Text; + ReturnText := FileDialog{%H-}.Files.Text; finally QStringList_destroy(ReturnList); end; @@ -684,23 +684,23 @@ var AInitDir: WideString; s: String; begin - ATitle := GetUtf8String(AFileDialog.Title); + ATitle := AFileDialog{%H-}.Title; QtFileDialog.setWindowTitle(@ATitle); {$ifndef QT_NATIVE_DIALOGS} s := AFileDialog.InitialDir; if UTF8Pos('$HOME', AFileDialog.InitialDir) > 0 then begin {$IFDEF MSWINDOWS} - AInitDir := GetEnvironmentVariableUTF8('HOMEDRIVE') + + AInitDir := GetEnvironmentVariableUTF8('HOMEDRIVE') {%H-}+ GetEnvironmentVariableUTF8('HOMEPATH'); {$ELSE} - AInitDir := GetEnvironmentVariableUTF8('HOME'); + AInitDir := {%H-}GetEnvironmentVariableUTF8('HOME'); {$ENDIF} s := StringReplace(S,'$HOME', UTF8Encode(AInitDir),[rfReplaceAll]); end; if not DirectoryExistsUTF8(S) then S := GetCurrentDirUTF8; - QtFileDialog.setDirectory(GetUTF8String(s)); + QtFileDialog.setDirectory(S{%H-}); {$else} S := AFileDialog.InitialDir; if not DirectoryExistsUTF8(S) then @@ -826,7 +826,7 @@ begin FileDialog.FileName := UTF16ToUTF8(ReturnText); {$endif} end; - ReturnText := FileDialog.Files.Text; + ReturnText := FileDialog{%H-}.Files.Text; finally QStringList_destroy(ReturnList); end; diff --git a/lcl/interfaces/qt5/qtwsextctrls.pp b/lcl/interfaces/qt5/qtwsextctrls.pp index 5f1906eccd..b1bcd5975e 100644 --- a/lcl/interfaces/qt5/qtwsextctrls.pp +++ b/lcl/interfaces/qt5/qtwsextctrls.pp @@ -209,7 +209,7 @@ begin QtGroupBox := TQtGroupBox.Create(AWinControl, AParams); QtGroupBox.GroupBoxType := tgbtRadioGroup; - Str := GetUtf8String(AWinControl.Caption); + Str := AWinControl{%H-}.Caption; QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str); QtGroupBox.AttachEvents; @@ -235,7 +235,7 @@ begin QtGroupBox := TQtGroupBox.Create(AWinControl, AParams); QtGroupBox.GroupBoxType := tgbtCheckGroup; - Str := GetUtf8String(AWinControl.Caption); + Str := AWinControl{%H-}.Caption; QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str); QtGroupBox.AttachEvents; diff --git a/lcl/interfaces/qt5/qtwsforms.pp b/lcl/interfaces/qt5/qtwsforms.pp index 1bfd953210..08cbd64f04 100644 --- a/lcl/interfaces/qt5/qtwsforms.pp +++ b/lcl/interfaces/qt5/qtwsforms.pp @@ -207,7 +207,7 @@ begin QtMainWindow.QtFormBorderStyle := Ord(AForm.BorderStyle); QtMainWindow.QtFormStyle := Ord(AForm.FormStyle); - Str := GetUtf8String(AWinControl.Caption); + Str := AWinControl{%H-}.Caption; QtMainWindow.SetWindowTitle(@Str); diff --git a/lcl/interfaces/qt5/qtwsmenus.pp b/lcl/interfaces/qt5/qtwsmenus.pp index 03a83fa5a9..1e2f53d70f 100644 --- a/lcl/interfaces/qt5/qtwsmenus.pp +++ b/lcl/interfaces/qt5/qtwsmenus.pp @@ -112,7 +112,7 @@ begin Result.setHasSubmenu(AMenuItem.Count > 0); if not AMenuItem.IsLine then begin - Result.setText(GetUtf8String(AMenuItem.Caption)); + Result.setText(AMenuItem.Caption{%H-}); Result.setEnabled(AMenuItem.Enabled); {issue #37741} @@ -283,7 +283,7 @@ begin if ACaption = cLineCaption then TQtMenu(Widget).setText('') else - TQtMenu(Widget).setText(GetUtf8String(ACaption)); + TQtMenu(Widget).setText(ACaption{%H-}); end; end; diff --git a/lcl/interfaces/qt5/qtwsstdctrls.pp b/lcl/interfaces/qt5/qtwsstdctrls.pp index dbe98720fe..1e96ebc046 100644 --- a/lcl/interfaces/qt5/qtwsstdctrls.pp +++ b/lcl/interfaces/qt5/qtwsstdctrls.pp @@ -756,7 +756,7 @@ var begin if not WSCheckHandleAllocated(ACustomMemo, 'AppendText') or (Length(AText) = 0) then Exit; - AStr := GetUtf8String(AText); + AStr := {%H-}AText; TQtTextEdit(ACustomMemo.Handle).BeginUpdate; TQtTextEdit(ACustomMemo.Handle).Append(AStr); TQtTextEdit(ACustomMemo.Handle).EndUpdate; @@ -1390,7 +1390,7 @@ begin Text := TCustomComboBox(AWinControl).Text; QtComboBox.FList.Assign(TCustomComboBox(AWinControl).Items); QtComboBox.setCurrentIndex(ItemIndex); - QtComboBox.setText(GetUTF8String(Text)); + QtComboBox.setText(Text{%H-}); QtComboBox.setEditable((AParams.Style and CBS_DROPDOWN <> 0) or (AParams.Style and CBS_SIMPLE <> 0));