mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 13:39:11 +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;
|
function CreateWidget(const Params: TCreateParams):QWidgetH; virtual;
|
||||||
procedure DestroyWidget; virtual;
|
procedure DestroyWidget; virtual;
|
||||||
procedure SetHasCaret(const AValue: Boolean);
|
procedure SetHasCaret(const AValue: Boolean);
|
||||||
|
function ProcessArrowKeys: Boolean; virtual;
|
||||||
|
|
||||||
class procedure removeProperty(AObject: QObjectH; APropName: PAnsiChar);
|
class procedure removeProperty(AObject: QObjectH; APropName: PAnsiChar);
|
||||||
class procedure setProperty(AObject: QObjectH; APropName: PAnsiChar; APropValue: Int64);
|
class procedure setProperty(AObject: QObjectH; APropName: PAnsiChar; APropValue: Int64);
|
||||||
@ -498,6 +499,8 @@ type
|
|||||||
{ TQtAbstractButton }
|
{ TQtAbstractButton }
|
||||||
|
|
||||||
TQtAbstractButton = class(TQtWidget)
|
TQtAbstractButton = class(TQtWidget)
|
||||||
|
protected
|
||||||
|
function ProcessArrowKeys: Boolean; override;
|
||||||
public
|
public
|
||||||
function CanPaintBackground: Boolean; override;
|
function CanPaintBackground: Boolean; override;
|
||||||
function getIconSize: TSize; virtual;
|
function getIconSize: TSize; virtual;
|
||||||
@ -2737,7 +2740,7 @@ var
|
|||||||
AQtKey: Cardinal;
|
AQtKey: Cardinal;
|
||||||
begin
|
begin
|
||||||
AQtKey := QKeyEvent_key(QKeyEventH(Event));
|
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));
|
or (AQtKey = QtKey_Up) or (AQtKey = QtKey_Down));
|
||||||
// and
|
// and
|
||||||
// Supports(Self, IQtEdit, QtEdit);
|
// Supports(Self, IQtEdit, QtEdit);
|
||||||
@ -4602,6 +4605,11 @@ begin
|
|||||||
FHasCaret := AValue;
|
FHasCaret := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidget.ProcessArrowKeys: Boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TQtWidget.removeProperty(AObject: QObjectH; APropName: PAnsiChar);
|
class procedure TQtWidget.removeProperty(AObject: QObjectH; APropName: PAnsiChar);
|
||||||
var
|
var
|
||||||
AVariant: QVariantH;
|
AVariant: QVariantH;
|
||||||
@ -5114,6 +5122,11 @@ begin
|
|||||||
QAbstractButton_setText(QAbstractButtonH(Widget), @W);
|
QAbstractButton_setText(QAbstractButtonH(Widget), @W);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtAbstractButton.ProcessArrowKeys: Boolean;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
function TQtAbstractButton.CanPaintBackground: Boolean;
|
function TQtAbstractButton.CanPaintBackground: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := CanSendLCLMessage and getEnabled and
|
Result := CanSendLCLMessage and getEnabled and
|
||||||
|
Loading…
Reference in New Issue
Block a user