mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 12:39:20 +02:00
qt: add bidimode support
git-svn-id: trunk@14846 -
This commit is contained in:
parent
eaa9030572
commit
371075ffd8
@ -186,6 +186,7 @@ type
|
||||
procedure setFocusProxy(const AWidget: QWidgetH);
|
||||
procedure setFont(AFont: QFontH);
|
||||
procedure setGeometry(ARect: TRect); overload;
|
||||
procedure setLayoutDirection(ADirection: QtLayoutDirection);
|
||||
procedure setMaximumSize(AWidth, AHeight: Integer);
|
||||
procedure setMask(AMask: QBitmapH);
|
||||
procedure setMinimumSize(AWidth, AHeight: Integer);
|
||||
@ -2624,6 +2625,11 @@ begin
|
||||
QWidget_setGeometry(Widget, @ARect);
|
||||
end;
|
||||
|
||||
procedure TQtWidget.setLayoutDirection(ADirection: QtLayoutDirection);
|
||||
begin
|
||||
QWidget_setLayoutDirection(Widget, ADirection);
|
||||
end;
|
||||
|
||||
procedure TQtWidget.setMaximumSize(AWidth, AHeight: Integer);
|
||||
begin
|
||||
QWidget_setMaximumSize(Widget, AWidth, AHeight);
|
||||
|
@ -78,6 +78,8 @@ type
|
||||
class procedure AddControl(const AControl: TControl); override;
|
||||
class function GetClientBounds(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
|
||||
class function GetClientRect(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
|
||||
|
||||
class procedure SetBiDiMode(const AWinControl: TWinControl; const ABiDiMode: TBiDiMode); override;
|
||||
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
|
||||
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
||||
class procedure SetPos(const AWinControl: TWinControl; const ALeft, ATop: Integer); override;
|
||||
@ -129,14 +131,20 @@ type
|
||||
public
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
const
|
||||
TBorderStyleToQtFrameShapeMap: array[TBorderStyle] of QFrameShape =
|
||||
(
|
||||
{bsNone} QFrameNoFrame,
|
||||
{bsSingle} QFrameStyledPanel
|
||||
{ bsNone } QFrameNoFrame,
|
||||
{ bsSingle } QFrameStyledPanel
|
||||
);
|
||||
TBidiModeToDirectionMap: array[TBiDiMode] of QtLayoutDirection =
|
||||
(
|
||||
{ bdLeftToRight } QtLeftToRight,
|
||||
{ bdRightToLeft } QtRightToLeft,
|
||||
{ bdRightToLeftNoAlign } QtRightToLeft, // ?
|
||||
{ bdRightToLeftReadingOnly } QtRightToLeft // ?
|
||||
);
|
||||
implementation
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TQtWSCustomControl.CreateHandle
|
||||
@ -311,6 +319,14 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
class procedure TQtWSWinControl.SetBiDiMode(const AWinControl: TWinControl;
|
||||
const ABiDiMode: TBiDiMode);
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AWinControl, 'SetBiDiMode') then
|
||||
Exit;
|
||||
TQtWidget(AWinControl.Handle).setLayoutDirection(TBidiModeToDirectionMap[ABiDiMode]);
|
||||
end;
|
||||
|
||||
class procedure TQtWSWinControl.GetPreferredSize(const AWinControl: TWinControl;
|
||||
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
|
||||
begin
|
||||
|
@ -31,7 +31,7 @@ interface
|
||||
uses
|
||||
// Bindings
|
||||
qt4,
|
||||
qtwidgets, qtobjects, qtproc,
|
||||
qtwidgets, qtobjects, qtproc, QtWsControls,
|
||||
// LCL
|
||||
SysUtils, Classes, LCLType, LCLProc, Graphics, Controls, Forms, Menus,
|
||||
// Widgetset
|
||||
@ -66,6 +66,7 @@ type
|
||||
protected
|
||||
public
|
||||
class function CreateHandle(const AMenu: TMenu): HMENU; override;
|
||||
class procedure SetBiDiMode(const AMenu: TMenu; const ABiDiMode: TBiDiMode); override;
|
||||
end;
|
||||
|
||||
{ TQtWSMainMenu }
|
||||
@ -386,6 +387,12 @@ begin
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
class procedure TQtWSMenu.SetBiDiMode(const AMenu: TMenu;
|
||||
const ABiDiMode: TBiDiMode);
|
||||
begin
|
||||
TQtWidget(AMenu.Handle).setLayoutDirection(TBidiModeToDirectionMap[ABidiMode]);
|
||||
end;
|
||||
|
||||
{ TQtWSPopupMenu }
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user