Qt: TToolBar should have QtTabFocus focuspolicy.Removed WSToolbar (native qt toolbar implementation) define.issue #19211

git-svn-id: trunk@30555 -
This commit is contained in:
zeljko 2011-05-05 09:38:58 +00:00
parent e8bc8ac225
commit a40f6e162e
2 changed files with 11 additions and 32 deletions

View File

@ -188,18 +188,13 @@ type
TQtWSToolButton = class(TWSToolButton)
published
{$ifdef WSToolBar}
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
{$endif}
end;
{ TQtWSToolBar }
TQtWSToolBar = class(TWSToolBar)
published
{$ifdef WSToolBar}
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
{$endif}
end;
{ TQtWSTrackBar }
@ -226,6 +221,7 @@ type
implementation
const
TickMarkToQtSliderTickPositionMap: array[TTickMark] of QSliderTickPosition =
(
@ -253,31 +249,23 @@ const
{iaLeft} QListViewLeftToRight
);
{ TQtWSToolButton }
{$ifdef WSToolBar}
class function TQtWSToolButton.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
QtToolButton: TQtToolButton;
begin
QtToolButton := TQtToolButton.Create(AWinControl, AParams);
QtToolButton.AttachEvents;
Result := TLCLIntfHandle(QtToolButton);
end;
{ TQtWSToolBar }
class function TQtWSToolBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
QtToolBar: TQtToolBar;
QtToolBar: TQtCustomControl;
begin
QtToolBar := TQtToolBar.Create(AWinControl, AParams);
{$note TToolBar implementation under LCL is wrong. TToolBar isn't
TCustomControl but TWinControl.
To avoid theoretical crashes we use TQtCustomControl here, but indeed it
should be TQtWidget - so no viewport.}
QtToolBar := TQtCustomControl.Create(AWinControl, AParams);
QtToolBar.setFrameShape(QFrameNoFrame);
QtToolBar.viewportNeeded;
QtToolBar.setFocusPolicy(QtTabFocus);
QtToolBar.AttachEvents;
Result := TLCLIntfHandle(QtToolBar);
end;
{$endif}
{ TQtWSTrackBar }

View File

@ -184,22 +184,13 @@ end;
function RegisterCustomToolButton: Boolean; alias : 'WSRegisterCustomToolButton';
begin
{$ifdef WSToolBar}
RegisterWSComponent(TCustomToolButton, TQtWSToolButton);
Result := True;
{$else}
Result := False;
{$endif}
end;
function RegisterToolBar: Boolean; alias : 'WSRegisterToolBar';
begin
{$ifdef WSToolBar}
RegisterWSComponent(TCustomToolBar, TQtWSToolBar);
RegisterWSComponent(TToolBar, TQtWSToolBar);
Result := True;
{$else}
Result := False;
{$endif}
end;
function RegisterCustomTrackBar: Boolean; alias : 'WSRegisterCustomTrackBar';