From cfa20195b1a74f50405cc14dbe2a3d7ff7e7501f Mon Sep 17 00:00:00 2001 From: zeljko Date: Mon, 31 May 2021 10:04:01 +0000 Subject: [PATCH] Qt: fixed using of plain text in dialogs. git-svn-id: trunk@65158 - --- lcl/interfaces/qt/qtwidgets.pas | 2 +- lcl/interfaces/qt/qtwinapi.inc | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 9fdc109845..936c991e04 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -19617,7 +19617,7 @@ begin AParent := QApplication_activeWindow; {$ENDIF} Widget := CreateWidget(AParent); - {$IFDEF QTDIALOGSUSEHTMLTEXT} + {$IFNDEF QTDIALOGSUSEHTMLTEXT} TextFormat := QtPlainText; {$ENDIF} setProperty(Widget, 'lclwidget', Int64(PtrUInt(Self))); diff --git a/lcl/interfaces/qt/qtwinapi.inc b/lcl/interfaces/qt/qtwinapi.inc index fd5f3da3a9..605f367104 100644 --- a/lcl/interfaces/qt/qtwinapi.inc +++ b/lcl/interfaces/qt/qtwinapi.inc @@ -5259,6 +5259,9 @@ var //OkStr: WideString; AParent: QWidgetH; DialogType, DefButton, DefIcon : Cardinal; + {$IFNDEF QTDIALOGSUSEHTMLTEXT} + AQtString: QStringH; + {$ENDIF} begin Result := 0; Str := lpText; @@ -5271,6 +5274,16 @@ begin DefButton:= ((uType and $00000300) shr 8) + 1; DialogType:= (uType and $0000000F); DefIcon := (uType and $000000FF) shr 4; + + + {$IFNDEF QTDIALOGSUSEHTMLTEXT} + //issue #37805 - we must show plain text. + AQtString := QString_Create(PWideString(@Str)); + QString_toHtmlEscaped(AQtString, @Str); + QString_destroy(AQtString); + {$ENDIF} + + case IconToMessageType(DefIcon) of QMessageBoxInformation: Result := QMessageBox_information(AParent, @TitleStr, @Str, ButtonToQtButtons(DialogType), ButtonToQtDefButton(DialogType, DefButton)); QMessageBoxQuestion: Result := QMessageBox_question(AParent, @TitleStr, @Str, ButtonToQtButtons(DialogType), ButtonToQtDefButton(DialogType, DefButton));