Qt,Qt5: allow usage of html formatted text in dialogs via define.

git-svn-id: trunk@64982 -
This commit is contained in:
zeljko 2021-04-13 11:41:26 +00:00
parent d84f74bc79
commit 0023eaced0
5 changed files with 10 additions and 0 deletions

View File

@ -15,4 +15,5 @@
{enable this define if you have problems when dialogs are shown behind application}
{.$DEFINE TQTMESSAGEBOXUSEPARENT}
{$ENDIF}
{.$DEFINE QTDIALOGSUSEHTMLTEXT} {we use plain text for dialogs - if enabled then dialogs can contain html formatted text}
{$ENDIF}

View File

@ -19617,7 +19617,9 @@ begin
AParent := QApplication_activeWindow;
{$ENDIF}
Widget := CreateWidget(AParent);
{$IFDEF QTDIALOGSUSEHTMLTEXT}
TextFormat := QtPlainText;
{$ENDIF}
setProperty(Widget, 'lclwidget', Int64(PtrUInt(Self)));
QtWidgetSet.AddHandle(Self);
end;

View File

@ -21,4 +21,5 @@
{enable this define if you have Qt build with "QT_NO_SESSIONMANAGER" for example Somlabs i.MX8 with Wayland }
{defined on Qt side in file "qtgui-config.h"}
{.$DEFINE QT_NO_SESSIONMANAGER}
{.$DEFINE QTDIALOGSUSEHTMLTEXT} {we use plain text for dialogs - if enabled then dialogs can contain html formatted text}
{$ENDIF}

View File

@ -19767,7 +19767,9 @@ begin
AParent := QApplication_activeWindow;
{$ENDIF}
Widget := CreateWidget(AParent);
{$IFNDEF QTDIALOGSUSEHTMLTEXT}
TextFormat := QtPlainText;
{$ENDIF}
setProperty(Widget, 'lclwidget', Int64(PtrUInt(Self)));
QtWidgetSet.AddHandle(Self);
end;

View File

@ -5202,7 +5202,9 @@ var
//OkStr: WideString;
AParent: QWidgetH;
DialogType, DefButton, DefIcon : Cardinal;
{$IFNDEF QTDIALOGSUSEHTMLTEXT}
AQtString: QStringH;
{$ENDIF}
begin
Result := 0;
Str := GetUtf8String(lpText);
@ -5216,10 +5218,12 @@ begin
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));