From aa578cedd1c06e4468254273ce456caeee57abfa Mon Sep 17 00:00:00 2001 From: zeljko Date: Tue, 8 May 2012 09:59:13 +0000 Subject: [PATCH] Qt: allow processing of arrow keys only on TQtAbstractButton (TButton,TBitBtn,TCheckBox,TRadioButton).second part of issue #21983 git-svn-id: trunk@37218 - --- lcl/interfaces/qt/qtwidgets.pas | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 67ae479b73..5beb981905 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -165,6 +165,7 @@ type function CreateWidget(const Params: TCreateParams):QWidgetH; virtual; procedure DestroyWidget; virtual; procedure SetHasCaret(const AValue: Boolean); + function ProcessArrowKeys: Boolean; virtual; class procedure removeProperty(AObject: QObjectH; APropName: PAnsiChar); class procedure setProperty(AObject: QObjectH; APropName: PAnsiChar; APropValue: Int64); @@ -498,6 +499,8 @@ type { TQtAbstractButton } TQtAbstractButton = class(TQtWidget) + protected + function ProcessArrowKeys: Boolean; override; public function CanPaintBackground: Boolean; override; function getIconSize: TSize; virtual; @@ -2737,7 +2740,7 @@ var AQtKey: Cardinal; begin AQtKey := QKeyEvent_key(QKeyEventH(Event)); - Result := ((AQtKey = QtKey_Left) or (AQtKey = QtKey_Right) + Result := not ProcessArrowKeys and ((AQtKey = QtKey_Left) or (AQtKey = QtKey_Right) or (AQtKey = QtKey_Up) or (AQtKey = QtKey_Down)); // and // Supports(Self, IQtEdit, QtEdit); @@ -4602,6 +4605,11 @@ begin FHasCaret := AValue; end; +function TQtWidget.ProcessArrowKeys: Boolean; +begin + Result := False; +end; + class procedure TQtWidget.removeProperty(AObject: QObjectH; APropName: PAnsiChar); var AVariant: QVariantH; @@ -5114,6 +5122,11 @@ begin QAbstractButton_setText(QAbstractButtonH(Widget), @W); end; +function TQtAbstractButton.ProcessArrowKeys: Boolean; +begin + Result := True; +end; + function TQtAbstractButton.CanPaintBackground: Boolean; begin Result := CanSendLCLMessage and getEnabled and