From c5accacd74b91991fc6fd1d13bdd39295f257457 Mon Sep 17 00:00:00 2001 From: zeljko Date: Tue, 10 Apr 2012 13:26:16 +0000 Subject: [PATCH] Qt: enable wordwrap on TQtStaticText. issue #21697 git-svn-id: trunk@36711 - --- lcl/interfaces/qt/qtwidgets.pas | 13 +++++++++++++ lcl/interfaces/qt/qtwsstdctrls.pp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 2f54f25d22..26e55b9a52 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -648,6 +648,8 @@ type TQtStaticText = class(TQtFrame) private + function GetWordWrap: Boolean; + procedure SetWordWrap(AValue: Boolean); protected function CreateWidget(const AParams: TCreateParams):QWidgetH; override; public @@ -655,6 +657,7 @@ type function getText: WideString; override; procedure setText(const W: WideString); override; procedure setAlignment(const AAlignment: QtAlignment); + property WordWrap: Boolean read GetWordWrap write SetWordWrap; end; { TQtCheckBox } @@ -6480,6 +6483,16 @@ end; { TQtStaticText } +function TQtStaticText.GetWordWrap: Boolean; +begin + Result := QLabel_wordWrap(QLabelH(Widget)); +end; + +procedure TQtStaticText.SetWordWrap(AValue: Boolean); +begin + QLabel_setWordWrap(QLabelH(Widget), AValue); +end; + function TQtStaticText.CreateWidget(const AParams: TCreateParams): QWidgetH; var Parent: QWidgetH; diff --git a/lcl/interfaces/qt/qtwsstdctrls.pp b/lcl/interfaces/qt/qtwsstdctrls.pp index 8bd3ca49eb..de037d9f41 100644 --- a/lcl/interfaces/qt/qtwsstdctrls.pp +++ b/lcl/interfaces/qt/qtwsstdctrls.pp @@ -1069,8 +1069,8 @@ var QtStaticText: TQtStaticText; begin QtStaticText := TQtStaticText.Create(AWinControl, AParams); + QtStaticText.WordWrap := True; QtStaticText.AttachEvents; - QtStaticText.setAlignment(AlignmentMap[TCustomStaticText(AWinControl).Alignment]); QtStaticText.setFrameShape(StaticBorderFrameShapeMap[TCustomStaticText(AWinControl).BorderStyle]); QtStaticText.setFrameShadow(StaticBorderFrameShadowMap[TCustomStaticText(AWinControl).BorderStyle]);