mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:39:30 +02:00
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:
parent
d487295f64
commit
aa578cedd1
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user