Qt: allow processing of arrow keys only on TQtAbstractButton (TButton,TBitBtn,TCheckBox,TRadioButton).second part of issue #21983

git-svn-id: trunk@37218 -
This commit is contained in:
zeljko 2012-05-08 09:59:13 +00:00
parent d487295f64
commit aa578cedd1

View File

@ -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