patch from zeljko. TCalendar implemented. Reimplemented TCustomCheckGroup and TCustomRadioGroup. Workaround for "Hidden radio button" problem. Added to this many small changes and switched the default qt version to 4.2

git-svn-id: trunk@11355 -
This commit is contained in:
sekelsenmat 2007-06-23 07:13:18 +00:00
parent 0ea8ca69fb
commit 0fb48e3d21
19 changed files with 1751 additions and 1162 deletions

2
.gitattributes vendored
View File

@ -2678,7 +2678,7 @@ lcl/interfaces/gtk2/tests/checkbuttononfixed.lpr svneol=native#text/plain
lcl/interfaces/qt/README.txt svneol=native#text/plain
lcl/interfaces/qt/interfaces.pp svneol=native#text/pascal
lcl/interfaces/qt/qt4.pas svneol=native#text/plain
lcl/interfaces/qt/qt42.pas -text
lcl/interfaces/qt/qt43.pas -text
lcl/interfaces/qt/qtcallback.inc svneol=native#text/pascal
lcl/interfaces/qt/qtint.pp svneol=native#text/pascal
lcl/interfaces/qt/qtlclintf.inc svneol=native#text/pascal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,9 +34,9 @@ interface
{$endif}
uses
// Bindings - qt4 must come first to avoid type redefinition problems on Windows
{$ifdef USE_QT_4_2}
qt42,
// Bindings - qt4 must come first to avoid type redefinition problems
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}
@ -44,7 +44,7 @@ uses
Classes, SysUtils, Math, Types,
// LCL
InterfaceBase, LCLProc, LCLType, LMessages, Controls, ExtCtrls, Forms,
Dialogs, StdCtrls, Comctrls, LCLIntf, GraphType, Themes;
Dialogs, StdCtrls, Comctrls, Calendar, LCLIntf, GraphType, Themes;
type
@ -124,7 +124,7 @@ uses
// QtWSActnList,
// QtWSArrow,
QtWSButtons,
// QtWSCalendar,
QtWSCalendar,
// QtWSCheckLst,
// QtWSCListBox,
QtWSComCtrls,

View File

@ -27,8 +27,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}
@ -268,6 +268,24 @@ type
procedure show;
procedure hide;
end;
{ TQtButtonGroup }
TQtButtonGroup = class(TObject)
private
public
constructor Create(AParent: QObjectH); virtual;
destructor Destroy; override;
Handle: QButtonGroupH;
public
procedure AddButton(AButton: QAbstractButtonH); overload;
procedure AddButton(AButton: QAbstractButtonH; Id: Integer); overload;
function ButtonFromId(id: Integer): QAbstractButtonH;
procedure RemoveButton(AButton: QAbstractButtonH);
function GetExclusive: Boolean;
procedure SetExclusive(AExclusive: Boolean);
procedure SignalButtonClicked(AButton: QAbstractButtonH); cdecl;
end;
procedure TQColorToColorRef(const AColor: TQColor; out AColorRef: TColorRef);
procedure ColorRefToTQColor(const AColorRef: TColorRef; var AColor:TQColor);
@ -1414,5 +1432,58 @@ begin
QSystemTrayIcon_hide(handle);
end;
{ TQtButtonGroup }
constructor TQtButtonGroup.Create(AParent: QObjectH);
var
Hook: QObject_hookH;
Method: TMethod;
begin
inherited Create;
Handle := QButtonGroup_create(AParent);
end;
destructor TQtButtonGroup.Destroy;
begin
QButtonGroup_destroy(Handle);
inherited Destroy;
end;
procedure TQtButtonGroup.AddButton(AButton: QAbstractButtonH); overload;
begin
QButtonGroup_addButton(Handle, AButton);
end;
procedure TQtButtonGroup.AddButton(AButton: QAbstractButtonH; id: Integer); overload;
begin
QButtonGroup_addButton(Handle, AButton, id);
end;
function TQtButtonGroup.ButtonFromId(id: Integer): QAbstractButtonH;
begin
Result := QButtonGroup_button(Handle, id);
end;
procedure TQtButtonGroup.RemoveButton(AButton: QAbstractButtonH);
begin
QButtonGroup_removeButton(Handle, AButton);
end;
procedure TQtButtonGroup.SetExclusive(AExclusive: Boolean);
begin
QButtonGroup_setExclusive(Handle, AExclusive);
end;
function TQtButtonGroup.GetExclusive: Boolean;
begin
QButtonGroup_exclusive(Handle);
end;
procedure TQtButtonGroup.SignalButtonClicked(AButton: QAbstractButtonH); cdecl;
begin
{todo}
end;
end.

View File

@ -27,8 +27,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}

View File

@ -18,8 +18,8 @@ uses
// rtl
Types, Classes, SysUtils,
// qt bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}

View File

@ -27,8 +27,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}
@ -114,6 +114,11 @@ type
procedure Text(retval: PWideString);
function isChecked: Boolean;
procedure setChecked(p1: Boolean);
procedure SignalPressed; cdecl;
procedure SignalReleased; cdecl;
procedure SignalClicked(Checked: Boolean = False); cdecl;
procedure SignalClicked2; cdecl;
procedure SignalToggled(Checked: Boolean); cdecl;
end;
{ TQtPushButton }
@ -137,7 +142,7 @@ type
protected
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
public
{$ifndef USE_QT_4_2}
{$ifdef USE_QT_4_3}
MDIAreaHandle: QMDIAreaH;
{$endif}
Splitter: QSplitterH;
@ -186,6 +191,7 @@ type
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override;
function CheckState: QtCheckState;
procedure setCheckState(state: QtCheckState);
procedure signalStateChanged(p1: Integer); cdecl;
end;
{ TQtRadioButton }
@ -205,10 +211,17 @@ type
protected
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
private
VBoxLayout: QVBoxLayoutH;
public
destructor Destroy; override;
end;
TQtButtonGroupBox = class(TQtGroupBox)
protected
private
public
ButtonGroup: TQtButtonGroup;
VBoxLayout: QVBoxLayoutH;
end;
{ TQtFrame }
@ -457,10 +470,8 @@ type
procedure SignalItemCollapsed(item: QTreeWidgetItemH) cdecl;
procedure SignalCurrentItemChanged(current: QTreeWidgetItemH; previous: QTreeWidgetItemH) cdecl;
procedure SignalItemSelectionChanged; cdecl;
end;
{ TQtMenu }
TQtMenu = class(TQtWidget)
@ -556,6 +567,21 @@ type
procedure setViewPort(AWidget: TQtWidget);
end;
{ TQtCalendar }
TQtCalendar = class(TQtWidget)
private
protected
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
public
AYear, AMonth, ADay: Word;
destructor Destroy; override;
procedure SignalActivated(ADate: QDateH); cdecl;
procedure SignalClicked(ADate: QDateH); cdecl;
procedure SignalSelectionChanged; cdecl;
procedure SignalCurrentPageChanged(p1, p2: Integer); cdecl;
end;
implementation
const
AlignmentMap: array[TAlignment] of QtAlignment =
@ -657,7 +683,7 @@ begin
inherited Destroy;
end;
{.$IFDEF VerboseQt}
{$IFDEF VerboseQt}
function EventTypeToStr(Event:QEventH):string;
begin
case QEvent_type(Event) of
@ -772,7 +798,7 @@ begin
QEventMaxUser: result:='QEventMaxUser';
end;
end;
{.$ENDIF}
{$ENDIF}
{------------------------------------------------------------------------------
Function: TQtWidget.EventFilter
@ -973,8 +999,6 @@ begin
WriteLn(' message: ', Msg.Msg);
{$endif}
try
{TODO: TStringGrid raises AV here while calling
editor ... fixme}
LCLObject.WindowProc(TLMessage(Msg));
except
Application.HandleException(nil);
@ -1012,11 +1036,10 @@ begin
MousePos := QMouseEvent_pos(QMouseEventH(Event))^;
Msg.Keys := 0;
//TODO: test this.
Modifiers := QInputEvent_modifiers(QInputEventH(Event));
if Modifiers and qtShiftModifier <> 0 then Msg.Keys := Msg.Keys or MK_SHIFT;
if Modifiers and qtControlModifier<>0 then Msg.Keys := Msg.Keys or MK_CONTROL;
//TODO: what about ALT, META, NUMKEYPAD?
{ TODO: add support for ALT, META and NUMKEYPAD }
Msg.XPos := SmallInt(MousePos.X);
Msg.YPos := SmallInt(MousePos.Y);
@ -1781,6 +1804,73 @@ begin
QAbstractButton_setChecked(QAbstractButtonH(Widget), p1);
end;
{------------------------------------------------------------------------------
Function: TQtAbstractButton.SignalPressed
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
procedure TQtAbstractButton.SignalPressed; cdecl;
var
Msg: TLMessage;
begin
FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_KEYDOWN;
DeliverMessage(Msg);
end;
{------------------------------------------------------------------------------
Function: TQtAbstractButton.SignalReleased
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
procedure TQtAbstractButton.SignalReleased; cdecl;
var
Msg: TLMessage;
begin
FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_KEYUP;
DeliverMessage(Msg);
end;
{------------------------------------------------------------------------------
Function: TQtAbstractButton.SignalClicked
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
procedure TQtAbstractButton.SignalClicked(Checked: Boolean = False); cdecl;
var
Msg: TLMessage;
begin
FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_CHANGED;
DeliverMessage(Msg);
end;
{------------------------------------------------------------------------------
Function: TQtAbstractButton.SignalClicked2
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
procedure TQtAbstractButton.SignalClicked2; cdecl;
var
Msg: TLMessage;
begin
FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_CLICKED;
DeliverMessage(Msg);
end;
{------------------------------------------------------------------------------
Function: TQtAbstractButton.SignalToggled
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
procedure TQtAbstractButton.SignalToggled(Checked: Boolean); cdecl;
begin
{use this for TToggleButton }
end;
{ TQtPushButton }
function TQtPushButton.CreateWidget(const AParams: TCreateParams): QWidgetH;
@ -1855,7 +1945,7 @@ function TQtMainWindow.CreateWidget(const AParams: TCreateParams): QWidgetH;
var
w: QWidgetH;
r: TRect;
{$ifndef USE_QT_4_2}
{$ifdef USE_QT_4_3}
mdihandle: QMdiAreaH;
toolbar: QToolBarH;
{$endif}
@ -1867,10 +1957,6 @@ begin
w := QApplication_activeWindow;
// mainform should be TQtMainWindow ...
{$ifndef USE_QT_4_2}
{$define mdidevel}
{$endif}
if not Assigned(w) and not (Application.MainForm.Visible) then
begin
Result := QMainWindow_create(nil, QtWindow);
@ -1881,30 +1967,31 @@ begin
if Assigned(Application.MainForm.Menu) then
QMainWindow_setMenuBar(QMainWindowH(Result), QMenuBarH(MenuBar.Widget));
{$ifdef mdidevel}
MDIAreaHandle := QMdiArea_create(Result);
{$ifdef USE_QT_4_3}
MDIAreaHandle := QMdiArea_create(Result);
QMainWindow_setCentralWidget(QMainWindowH(Result), MDIAreaHandle);
QMainWindow_setCentralWidget(QMainWindowH(Result), MDIAreaHandle);
{$endif}
{$ifndef USE_QT_4_2}
QMainWindow_setDockOptions(QMainWindowH(Result), QMainWindowAnimatedDocks);
{$endif}
end else
begin
{$ifdef mdidevel}
if LCLObject.Tag = 9999 then
begin
Result := QMdiSubWindow_create(NiL, QtWindow);
{$ifdef USE_QT_4_3}
if LCLObject.Tag = 9999 then
begin
Result := QMdiSubWindow_create(NiL, QtWindow);
mdiHandle := TQtMainWindow(Application.MainForm.Handle).MDIAreaHandle;
if Assigned(mdiHandle) then
QMdiArea_addSubWindow(mdiHandle, QMdiSubWindowH(Result), QtWindow);
end else
mdiHandle := TQtMainWindow(Application.MainForm.Handle).MDIAreaHandle;
if Assigned(mdiHandle) then
QMdiArea_addSubWindow(mdiHandle, QMdiSubWindowH(Result), QtWindow);
end
else
Result := QWidget_create(nil, QtWindow);
{$else}
Result := QWidget_create(nil, QtWindow);
{$endif}
Result := QWidget_create(nil, QtWindow);
// Main menu bar
MenuBar := TQtMenuBar.Create(Result);
end;
@ -2152,17 +2239,24 @@ begin
{$ifdef VerboseQt}
WriteLn('TQtCheckBox.Create');
{$endif}
if (LCLObject.Parent is TCustomCheckGroup) then
begin
Result := QCheckBox_create;
QLayout_addWidget(TQtGroupBox(LCLObject.Parent.Handle).VBoxLayout, Result);
QLayout_addWidget(TQtButtonGroupBox(LCLObject.Parent.Handle).VBoxLayout, Result);
if TQtButtonGroupBox(LCLObject.Parent.Handle).ButtonGroup.GetExclusive then
TQtButtonGroupBox(LCLObject.Parent.Handle).ButtonGroup.SetExclusive(False);
TQtButtonGroupBox(LCLObject.Parent.Handle).ButtonGroup.AddButton(QCheckBoxH(Result));
end
else
begin
Parent := TQtWidget(LCLObject.Parent.Handle).Widget;
Result := QCheckBox_create(Parent);
end;
end;
procedure TQtCheckBox.SetGeometry;
@ -2197,8 +2291,7 @@ end;
function TQtCheckBox.EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl;
begin
Result := False;
// Inherited Callbacks
inherited EventFilter(Sender, Event);
end;
@ -2222,6 +2315,20 @@ begin
QCheckBox_setCheckState(QCheckBoxH(Widget), state);
end;
{------------------------------------------------------------------------------
Function: TQtCheckBox.signalStateChanged
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
procedure TQtCheckBox.signalStateChanged(p1: Integer); cdecl;
var
Msg: TLMessage;
begin
FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_CHANGED;
DeliverMessage(Msg);
end;
{ TQtRadioButton }
function TQtRadioButton.CreateWidget(const AParams: TCreateParams): QWidgetH;
@ -2237,7 +2344,22 @@ begin
if (LCLObject.Parent is TCustomRadioGroup) then
begin
Result := QRadioButton_create;
QLayout_addWidget(TQtGroupBox(LCLObject.Parent.Handle).VBoxLayout, Result);
{$ifdef QT_HIDDEN_BUTTON_WORKAROUND}
if LCLObject.Name = 'HiddenRadioButton' then
QWidget_hide(Result)
else
begin
{$endif}
QLayout_addWidget(TQtButtonGroupBox(LCLObject.Parent.Handle).VBoxLayout, Result);
if not TQtButtonGroupBox(LCLObject.Parent.Handle).ButtonGroup.GetExclusive then
TQtButtonGroupBox(LCLObject.Parent.Handle).ButtonGroup.SetExclusive(True);
TQtButtonGroupBox(LCLObject.Parent.Handle).ButtonGroup.AddButton(QRadioButtonH(Result));
{$ifdef QT_HIDDEN_BUTTON_WORKAROUND}
end;
{$endif}
end
else
begin
@ -2288,6 +2410,8 @@ end;
function TQtGroupBox.CreateWidget(const AParams: TCreateParams): QWidgetH;
var
Parent: QWidgetH;
R: TRect;
Method: TMethod;
begin
// Creates the widget
{$ifdef VerboseQt}
@ -2295,15 +2419,6 @@ begin
{$endif}
Parent := TQtWidget(LCLObject.Parent.Handle).Widget;
Result := QGroupBox_create(Parent);
{------------------------------------------------------------------------------
Adds a vertical layout if the control is a group
------------------------------------------------------------------------------}
if (LCLOBject is TCustomRadioGroup) or (LCLObject is TCustomCheckGroup) then
begin
VBoxLayout := QVBoxLayout_create;
QWidget_setLayout(Result, VBoxLayout);
end;
end;
@ -2324,6 +2439,7 @@ begin
inherited Destroy;
end;
{ TQtFrame }
function TQtFrame.CreateWidget(const AParams: TCreateParams): QWidgetH;
@ -2425,7 +2541,8 @@ end;
------------------------------------------------------------------------------}
procedure TQtAbstractSlider.SlotRangeChanged(minimum: Integer; maximum: Integer); cdecl;
begin
{TODO: what to do on rangeChanged ? repaint or recount pageSize() }
{ TODO: find out what needs to be done on rangeChanged event
Possibilities: repaint or recount pageSize() }
{$ifdef VerboseQt}
writeln('TQtAbstractSlider.rangeChanged() to min=',minimum,' max=',maximum);
{$endif}
@ -2572,7 +2689,7 @@ begin
LMScroll.Msg := LM_VSCROLL;
LMScroll.Pos := p1;
LMScroll.ScrollCode := SIF_POS; {what about SIF_TRACKPOS ?!?}
LMScroll.ScrollCode := SIF_POS; { SIF_TRACKPOS }
Msg := @LMScroll;
@ -2917,7 +3034,6 @@ procedure TQtTextEdit.SetAlignment(const AAlignment: TAlignment);
var
TextCursor: QTextCursorH;
begin
// Paul Ishenin:
// QTextEdit supports alignment for every paragraph. We need to align all text.
// So, we should select all text, set format, and clear selection
@ -3207,12 +3323,12 @@ begin
WriteLn('TQtAbstractSpinBox.SignalEditingFinished');
{$endif}
FillChar(Msg, SizeOf(Msg), #0);
{TODO: What message should be sended here ?!?
problem:
everything is fine when we work with mouse,or
press TabKey to select next control, but if we
connect OnKeyDown and say eg. VK_RETURN:SelectNext(ActiveControl, true, true)
then spinedit text is always selected, nothing important but looks ugly.}
{ TODO: Find out which message should be sended here
problem:
everything is fine when we work with mouse, or
press TabKey to select next control, but if we
connect OnKeyDown and say eg. VK_RETURN: SelectNext(ActiveControl, true, true)
then spinedit text is always selected, nothing important but looks ugly.}
// Msg.Msg := LM_EXIT;
// DeliverMessage(Msg);
end;
@ -4235,6 +4351,135 @@ begin
end;
end;
{ TQtCalendar }
{------------------------------------------------------------------------------
Function: TQtCalendar.CreateWidget
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
function TQtCalendar.CreateWidget(const AParams: TCreateParams):QWidgetH;
var
Parent: QWidgetH;
begin
// Creates the widget
{$ifdef VerboseQt}
WriteLn('TQtCalendar.Create');
{$endif}
Parent := TQtWidget(LCLObject.Parent.Handle).Widget;
Result := QCalendarWidget_create(Parent);
end;
{------------------------------------------------------------------------------
Function: TQtCalendar.Destroy
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
destructor TQtCalendar.Destroy;
begin
{$ifdef VerboseQt}
WriteLn('TQtCalendar.Destroy');
{$endif}
QCalendarWidget_destroy(QCalendarWidgetH(Widget));
Widget:=nil;
inherited Destroy;
end;
{------------------------------------------------------------------------------
Function: TQtCalendar.SignalActivated
Params: None
Returns: Nothing
Sends signal when RETURN pressed on selected date.
------------------------------------------------------------------------------}
procedure TQtCalendar.SignalActivated(ADate: QDateH); cdecl;
var
Msg: TLMessage;
y,m,d: Integer;
begin
{this one triggers if we press RETURN on selected date
shell we send KeyDown here ?!?}
FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_DAYCHANGED;
y := QDate_year(ADate);
m := QDate_month(ADate);
d := QDate_day(ADate);
if (y <> aYear) or (m <> aMonth)
or (d <> aDay) then
DeliverMessage(Msg);
end;
{------------------------------------------------------------------------------
Function: TQtCalendar.SignalClicked
Params: None
Returns: Nothing
Sends msg LM_DAYCHANGED when OldDate<>NewDate
------------------------------------------------------------------------------}
procedure TQtCalendar.SignalClicked(ADate: QDateH); cdecl;
var
Msg: TLMessage;
y,m,d: Integer;
begin
// writeln('TQtCalendar.signalClicked');
FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_DAYCHANGED;
y := QDate_year(ADate);
m := QDate_month(ADate);
d := QDate_day(ADate);
if (y <> aYear) or (m <> aMonth)
or (d <> aDay) then
DeliverMessage(Msg);
end;
{------------------------------------------------------------------------------
Function: TQtCalendar.SignalSelectionChanged
Params: None
Returns: Nothing
Notes: no event for date changed by keyboard ?!?
always triggers even if selection isn't changed ...
this is not Qt4 bug ... tested with pure Qt C++ app
------------------------------------------------------------------------------}
procedure TQtCalendar.SignalSelectionChanged; cdecl;
var
Msg: TLMessage;
begin
// writeln('TQtCalendar.SignalSelectionChanged');
FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_DAYCHANGED;
DeliverMessage(Msg);
end;
{------------------------------------------------------------------------------
Function: TQtCalendar.SignalCurrentPageChanged
Params: None
Returns: Nothing
Notes: fixme what's wrong with those values ?!?
with pure Qt C++ app this works ok, but via bindings get
impossible year & month values ...
------------------------------------------------------------------------------}
procedure TQtCalendar.SignalCurrentPageChanged(p1, p2: Integer); cdecl;
var
Msg: TLMessage;
begin
// writeln('TQtCalendar.SignalCurrentPageChanged p1=',p1,' p2=',p2);
FillChar(Msg, SizeOf(Msg), #0);
if AYear<>p1 then
begin
Msg.Msg := LM_YEARCHANGED;
DeliverMessage(Msg);
end;
if AMonth<>p2 then
begin
Msg.Msg := LM_MONTHCHANGED;
DeliverMessage(Msg);
end;
end;
end.

View File

@ -28,8 +28,8 @@ interface
uses
// Libs
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}
@ -153,8 +153,8 @@ var
Str: WideString;
begin
Result := False;
if not WSCheckHandleAllocated(AWincontrol, 'GetText')
then Exit;
if not WSCheckHandleAllocated(AWincontrol, 'GetText') then Exit;
TQtAbstractButton(AWinControl.Handle).Text(@Str);
@ -172,8 +172,7 @@ class procedure TQtWSButton.SetText(const AWinControl: TWinControl; const AText:
var
Str: WideString;
begin
if not WSCheckHandleAllocated(AWincontrol, 'SetText')
then Exit;
if not WSCheckHandleAllocated(AWincontrol, 'SetText') then Exit;
Str := UTF8Decode(AText);
@ -193,8 +192,7 @@ var
QColor: TQColor;
Color: TColor;
begin
if not WSCheckHandleAllocated(AWincontrol, 'SetColor')
then Exit;
if not WSCheckHandleAllocated(AWincontrol, 'SetColor') then Exit;
if AWinControl.Color = CLR_INVALID then exit;
@ -273,8 +271,8 @@ var
Str: WideString;
begin
Result := False;
if not WSCheckHandleAllocated(AWincontrol, 'GetText')
then Exit;
if not WSCheckHandleAllocated(AWincontrol, 'GetText') then Exit;
TQtAbstractButton(AWinControl.Handle).Text(@Str);
@ -293,8 +291,8 @@ class procedure TQtWSBitBtn.SetText(const AWinControl: TWinControl;
var
Str: WideString;
begin
if not WSCheckHandleAllocated(AWincontrol, 'SetText')
then Exit;
if not WSCheckHandleAllocated(AWincontrol, 'SetText') then Exit;
Str := UTF8Decode(AText);
TQtAbstractButton(AWinControl.Handle).SetText(@Str);
@ -313,8 +311,7 @@ var
QColor: TQColor;
Color: TColor;
begin
if not WSCheckHandleAllocated(AWincontrol, 'SetColor')
then Exit;
if not WSCheckHandleAllocated(AWincontrol, 'SetColor') then Exit;
if AWinControl.Color = CLR_INVALID then exit;

View File

@ -22,19 +22,21 @@
}
unit QtWSCalendar;
{$mode objfpc}{$H+}
{$mode delphi}{$H+}
interface
uses
////////////////////////////////////////////////////
// I M P O R T A N T
////////////////////////////////////////////////////
// To get as little as posible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
// Calendar,
////////////////////////////////////////////////////
// Bindings
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}
qtwidgets,
// LCL
SysUtils, DateUtils, Controls, Calendar, LCLType, LCLIntf, LCLProc,
// Widgetset
WSCalendar, WSLCLClasses;
type
@ -45,11 +47,135 @@ type
private
protected
public
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
public
class function GetDateTime(const ACalendar: TCustomCalendar): TDateTime; override;
class procedure SetDateTime(const ACalendar: TCustomCalendar; const ADateTime: TDateTime); override;
class procedure SetDisplaySettings(const ACalendar: TCustomCalendar; const ADisplaySettings: TDisplaySettings); override;
class procedure SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean); override;
end;
implementation
{ TQtWSCustomCalendar }
class function TQtWSCustomCalendar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
QtCalendar: TQtCalendar;
Hook: QCalendarWidget_hookH;
Method: TMethod;
begin
QtCalendar := TQtCalendar.Create(AWinControl, AParams);
Hook := QCalendarWidget_hook_create(QtCalendar.Widget);
TEventFilterMethod(Method) := QtCalendar.EventFilter;
QObject_hook_hook_events(Hook, Method);
QCalendarWidget_clicked_Event(Method) := QtCalendar.SignalClicked;
QCalendarWidget_hook_hook_clicked(QCalendarWidget_hook_create(QtCalendar.Widget), Method);
QCalendarWidget_activated_Event(Method) := QtCalendar.SignalActivated;
QCalendarWidget_hook_hook_activated(QCalendarWidget_hook_create(QtCalendar.Widget), Method);
QCalendarWidget_selectionChanged_Event(Method) := QtCalendar.SignalSelectionChanged;
QCalendarWidget_hook_hook_clicked(QCalendarWidget_hook_create(QtCalendar.Widget), Method);
QCalendarWidget_currentPageChanged_Event(Method) := QtCalendar.SignalCurrentPageChanged;
QCalendarWidget_hook_hook_clicked(QCalendarWidget_hook_create(QtCalendar.Widget), Method);
QWidget_setFocusPolicy(QtCalendar.Widget, QtTabFocus or QtClickFocus);
Result := THandle(QtCalendar);
end;
class procedure TQtWSCustomCalendar.DestroyHandle(const AWinControl: TWinControl);
begin
TQtCalendar(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
class procedure TQtWSCustomCalendar.SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean);
var
QtCalendar: TQtCalendar;
begin
QtCalendar := TQtCalendar(ACalendar.Handle);
if AReadOnly then
QCalendarWidget_setSelectionMode(QCalendarWidgetH(QtCalendar.Widget), QCalendarWidgetNoSelection)
else QCalendarWidget_setSelectionMode(QCalendarWidgetH(QtCalendar.Widget), QCalendarWidgetSingleSelection);
{$ifdef USE_QT_4_3}
QCalendarWidget_setDateEditEnabled(QCalendarWidgetH(QtCalendar.Widget), not AReadOnly);
{$endif}
end;
class function TQtWSCustomCalendar.GetDateTime(const ACalendar: TCustomCalendar): TDateTime;
var
QtCalendar: TQtCalendar;
ADate: QDateH;
begin
QtCalendar := TQtCalendar(ACalendar.Handle);
ADate := QDate_create;
try
QCalendarWidget_selectedDate(QCalendarWidgetH(QtCalendar.Widget), ADate);
QtCalendar.AYear := QDate_year(ADate);
QtCalendar.AMonth := QDate_month(ADate);
QtCalendar.ADay := QDate_day(ADate);
Result := EncodeDate(QtCalendar.AYear, QtCalendar.AMonth, QtCalendar.ADay);
finally
QDate_destroy(ADate);
end;
end;
class procedure TQtWSCustomCalendar.SetDateTime(const ACalendar: TCustomCalendar; const ADateTime: TDateTime);
var
QtCalendar: TQtCalendar;
ADate: QDateH;
begin
QtCalendar := TQtCalendar(ACalendar.Handle);
DecodeDate(ADateTime, QtCalendar.AYear, QtCalendar.AMonth, QtCalendar.ADay);
ADate := QDate_create(QtCalendar.AYear, QtCalendar.AMonth, QtCalendar.ADay);
try
QCalendarWidget_setCurrentPage(QCalendarWidgetH(QtCalendar.Widget), QtCalendar.AYear, QtCalendar.AMonth);
QCalendarWidget_setSelectedDate(QCalendarWidgetH(QtCalendar.Widget), ADate);
finally
QDate_destroy(ADate);
end;
end;
class procedure TQtWSCustomCalendar.SetDisplaySettings(const ACalendar: TCustomCalendar;
const ADisplaySettings: TDisplaySettings);
var
QtCalendar: TQtCalendar;
begin
QtCalendar := TQtCalendar(ACalendar.Handle);
QCalendarWidget_setHeaderVisible(QCalendarWidgetH(QtCalendar.Widget), dsShowHeadings in ADisplaySettings);
if dsShowDayNames in ADisplaySettings then
QCalendarWidget_setHorizontalHeaderFormat(QCalendarWidgetH(QtCalendar.Widget),QCalendarWidgetShortDayNames)
else QCalendarWidget_setHorizontalHeaderFormat(QCalendarWidgetH(QtCalendar.Widget), QCalendarWidgetNoHorizontalHeader);
{$ifdef USE_QT_4_3}
QCalendarWidget_setNavigationBarVisible(QCalendarWidgetH(QtCalendar.Widget), not (dsNoMonthChange in ADisplaySettings));
{$endif}
if dsShowWeekNumbers in ADisplaySettings then
QCalendarWidget_setVerticalHeaderFormat(QCalendarWidgetH(QtCalendar.Widget), QCalendarWidgetISOWeekNumbers)
else QCalendarWidget_setVerticalHeaderFormat(QCalendarWidgetH(QtCalendar.Widget), QCalendarWidgetNoVerticalHeader);
QCalendarWidget_setGridVisible(QCalendarWidgetH(QtCalendar.Widget), dsShowWeekNumbers in ADisplaySettings);
if dsStartMonday in ADisplaySettings then
QCalendarWidget_setFirstDayOfWeek(QCalendarWidgetH(QtCalendar.Widget), QtMonday)
else QCalendarWidget_setFirstDayOfWeek(QCalendarWidgetH(QtCalendar.Widget), QtSunday);
end;
initialization
////////////////////////////////////////////////////
@ -58,6 +184,6 @@ initialization
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
// RegisterWSComponent(TCustomCalendar, TQtWSCustomCalendar);
RegisterWSComponent(TCustomCalendar, TQtWSCustomCalendar);
////////////////////////////////////////////////////
end.
end.

View File

@ -28,8 +28,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}

View File

@ -28,8 +28,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}

View File

@ -28,8 +28,8 @@ interface
uses
// Libs
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}

View File

@ -28,14 +28,14 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}
qtwidgets,
qtwidgets, qtobjects,
// LCL
SysUtils, Controls, Forms, ExtCtrls, LCLType,
SysUtils, Classes, Controls, Forms, StdCtrls, ExtCtrls, LCLType,
// Widgetset
WSExtCtrls, WSLCLClasses;
@ -158,6 +158,10 @@ type
private
protected
public
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class procedure ShowHide(const AWinControl: TWinControl); override;
end;
{ TQtWSRadioGroup }
@ -174,6 +178,10 @@ type
private
protected
public
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class procedure ShowHide(const AWinControl: TWinControl); override;
end;
{ TQtWSCheckGroup }
@ -419,6 +427,117 @@ begin
TQtTabWidget(ANotebook.Handle).SetTabPosition(QTabWidgetTabPositionMap[ATabPosition]);
end;
{ TQtWSCustomRadioGroup }
{------------------------------------------------------------------------------
Method: TQtWSCustomRadioGroup.CreateHandle
Params: None
Returns: Nothing
Allocates memory and resources for the control and shows it
------------------------------------------------------------------------------}
class function TQtWSCustomRadioGroup.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle;
var
QtGroupBox: TQtButtonGroupBox;
Str: WideString;
Method: TMethod;
Hook : QGroupBox_hookH;
begin
QtGroupBox := TQtButtonGroupBox.Create(AWinControl, AParams);
QtGroupBox.VBoxLayout := QVBoxLayout_create;
QWidget_setLayout(QtGroupBox.Widget, QtGroupBox.VBoxLayout);
QtGroupBox.ButtonGroup := TQtButtonGroup.Create(QObjectH(QtGroupBox.VBoxLayout));
Hook := QGroupBox_hook_create(QtGroupBox.Widget);
TEventFilterMethod(Method) := QtGroupBox.EventFilter;
QObject_hook_hook_events(Hook, Method);
Str := UTF8Decode(AWinControl.Caption);
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
Result := THandle(QtGroupBox);
end;
{------------------------------------------------------------------------------
Method: TQtWSCustomRadioGroup.DestroyHandle
Params: None
Returns: Nothing
Releases allocated memory and resources
------------------------------------------------------------------------------}
class procedure TQtWSCustomRadioGroup.DestroyHandle(const AWinControl: TWinControl);
begin
TQtGroupBox(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
class procedure TQtWSCustomRadioGroup.ShowHide(const AWinControl: TWinControl);
begin
inherited ShowHide(AWinControl);
{without this we have invisible radio buttons}
end;
{ TQtWSCustomCheckGroup }
{------------------------------------------------------------------------------
Method: TQtWSCustomCheckGroup.CreateHandle
Params: None
Returns: Nothing
Allocates memory and resources for the control and shows it
------------------------------------------------------------------------------}
class function TQtWSCustomCheckGroup.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle;
var
QtGroupBox: TQtButtonGroupBox;
Str: WideString;
Method: TMethod;
Hook : QGroupBox_hookH;
begin
QtGroupBox := TQtButtonGroupBox.Create(AWinControl, AParams);
QtGroupBox.VBoxLayout := QVBoxLayout_create;
QWidget_setLayout(QtGroupBox.Widget, QtGroupBox.VBoxLayout);
QtGroupBox.ButtonGroup := TQtButtonGroup.Create(QObjectH(QtGroupBox.VBoxLayout));
Hook := QGroupBox_hook_create(QtGroupBox.Widget);
TEventFilterMethod(Method) := QtGroupBox.EventFilter;
QObject_hook_hook_events(Hook, Method);
Str := UTF8Decode(AWinControl.Caption);
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
Result := THandle(QtGroupBox);
end;
{------------------------------------------------------------------------------
Method: TQtWSCustomCheckGroup.DestroyHandle
Params: None
Returns: Nothing
Releases allocated memory and resources
------------------------------------------------------------------------------}
class procedure TQtWSCustomCheckGroup.DestroyHandle(const AWinControl: TWinControl);
begin
TQtGroupBox(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
class procedure TQtWSCustomCheckGroup.ShowHide(const AWinControl: TWinControl);
begin
inherited ShowHide(AWinControl);
{without this checkboxes are invisible}
end;
initialization
////////////////////////////////////////////////////
@ -438,9 +557,9 @@ initialization
// RegisterWSComponent(TCustomImage, TQtWSCustomImage);
// RegisterWSComponent(TImage, TQtWSImage);
// RegisterWSComponent(TBevel, TQtWSBevel);
// RegisterWSComponent(TCustomRadioGroup, TQtWSCustomRadioGroup);
RegisterWSComponent(TCustomRadioGroup, TQtWSCustomRadioGroup);
// RegisterWSComponent(TRadioGroup, TQtWSRadioGroup);
// RegisterWSComponent(TCustomCheckGroup, TQtWSCustomCheckGroup);
RegisterWSComponent(TCustomCheckGroup, TQtWSCustomCheckGroup);
// RegisterWSComponent(TCheckGroup, TQtWSCheckGroup);
// RegisterWSComponent(TCustomLabeledEdit, TQtWSCustomLabeledEdit);
// RegisterWSComponent(TLabeledEdit, TQtWSLabeledEdit);

View File

@ -28,8 +28,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}

View File

@ -28,8 +28,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}

View File

@ -28,8 +28,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}

View File

@ -28,8 +28,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}
@ -96,7 +96,7 @@ var
FIsFloat: Boolean;
begin
{qt4 have two different QSpinBoxes, one is QSpinBox (integer), another is QDoubleSpinBox (double) }
{ qt4 has two different QSpinBoxes, one is QSpinBox (integer), another is QDoubleSpinBox (double) }
FIsFloat := TCustomFloatSpinEdit(AWinControl).DecimalPlaces > 0;
@ -110,7 +110,9 @@ begin
Hook := QAbstractSpinBox_hook_create(QtFloatSpinBox.Widget);
TEventFilterMethod(Method) := QtFloatSpinBox.EventFilter;
QObject_hook_hook_events(Hook, Method);
{TODO: what TLMessage should be sended ? }
{TODO: find out which TLMessage should be sended }
QAbstractSpinBox_editingFinished_Event(Method) := QtFloatSpinBox.SignalEditingFinished;
QAbstractSpinBox_hook_hook_editingFinished(QAbstractSpinBox_hook_create(QtFloatSpinBox.Widget), Method);
@ -122,19 +124,18 @@ begin
Hook := QAbstractSpinBox_hook_create(QtSpinBox.Widget);
TEventFilterMethod(Method) := QtSpinBox.EventFilter;
QObject_hook_hook_events(Hook, Method);
{TODO: what TLMessage should be sended ? }
{TODO: find out which TLMessage should be sended }
QAbstractSpinBox_editingFinished_Event(Method) := QtSpinBox.SignalEditingFinished;
QAbstractSpinBox_hook_hook_editingFinished(QAbstractSpinBox_hook_create(QtSpinBox.Widget), Method);
QSpinBox_valueChanged_Event(Method) := QtSpinBox.SignalValueChanged;
QSpinBox_hook_hook_valueChanged(QSpinBox_hook_create(QtSpinBox.Widget), Method);
end;
if FIsFloat then
Result := THandle(QtFloatSpinBox)
else
Result := THandle(QtSpinBox);
if FIsFloat then Result := THandle(QtFloatSpinBox)
else Result := THandle(QtSpinBox);
end;
{------------------------------------------------------------------------------
@ -144,11 +145,10 @@ end;
------------------------------------------------------------------------------}
class procedure TQtWSCustomFloatSpinEdit.DestroyHandle(const AWinControl: TWinControl);
begin
if TCustomFloatSpinEdit(AWinControl).DecimalPlaces > 0 then
TQtFloatSpinBox(AWinControl.Handle).Free
TQtFloatSpinBox(AWinControl.Handle).Free
else
TQtSpinBox(AWinControl.Handle).Free;
TQtSpinBox(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
@ -156,17 +156,16 @@ end;
class function TQtWSCustomFloatSpinEdit.GetValue(const ACustomFloatSpinEdit: TCustomFloatSpinEdit): single;
begin
if ACustomFloatSpinEdit.DecimalPlaces > 0 then
Result := QDoubleSpinBox_value(QDoubleSpinBoxH(TQtFloatSpinBox(ACustomFloatSpinEdit.Handle).Widget))
Result := QDoubleSpinBox_value(QDoubleSpinBoxH(TQtFloatSpinBox(ACustomFloatSpinEdit.Handle).Widget))
else
Result := QSpinBox_value(QSpinBoxH(TQtFloatSpinBox(ACustomFloatSpinEdit.Handle).Widget));
Result := QSpinBox_value(QSpinBoxH(TQtFloatSpinBox(ACustomFloatSpinEdit.Handle).Widget));
end;
class procedure TQtWSCustomFloatSpinEdit.UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit);
var
QtSpinEdit: TQtSpinBox;
QtFloatSpinEdit: TQtFloatSpinBox;
QtSpinEdit: TQtSpinBox;
QtFloatSpinEdit: TQtFloatSpinBox;
begin
if ACustomFloatSpinEdit.DecimalPlaces > 0 then
begin
QtFloatSpinEdit := TQtFloatSpinBox(ACustomFloatSpinEdit.Handle);
@ -175,7 +174,8 @@ begin
QDoubleSpinBox_setMinimum(QDoubleSpinBoxH(QtFloatSpinEdit.Widget), ACustomFloatSpinEdit.MinValue);
QDoubleSpinBox_setMaximum(QDoubleSpinBoxH(QtFloatSpinEdit.Widget), ACustomFloatSpinEdit.MaxValue);
QDoubleSpinBox_setSingleStep(QDoubleSpinBoxH(QtFloatSpinEdit.Widget), ACustomFloatSpinEdit.Increment);
end else
end
else
begin
QtSpinEdit := TQtSpinBox(ACustomFloatSpinEdit.Handle);
QSpinBox_setValue(QSpinBoxH(QtSpinEdit.Widget), Round(ACustomFloatSpinEdit.Value));
@ -183,7 +183,6 @@ begin
QSpinBox_setMaximum(QSpinBoxH(QtSpinEdit.Widget), Round(ACustomFloatSpinEdit.MaxValue));
QSpinBox_setSingleStep(QSpinBoxH(QtSpinEdit.Widget), Round(ACustomFloatSpinEdit.Increment));
end;
end;
initialization

View File

@ -28,8 +28,8 @@ interface
uses
// Bindings
{$ifdef USE_QT_4_2}
qt42,
{$ifdef USE_QT_4_3}
qt43,
{$else}
qt4,
{$endif}
@ -1024,14 +1024,29 @@ end;
class function TQtWSCustomCheckBox.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
QtCheckBox: TQtCheckBox;
Method: TMethod;
Hook : QAbstractButton_hookH;
begin
QtCheckBox := TQtCheckBox.Create(AWinControl, AParams);
// Focus
// QWidget_setFocusPolicy(QtCheckBox.Widget, QtStrongFocus);
{we have a bug in LCL when parent is TCustomCheckGroup, it doesn't set sizes for items ?!? Width = 0 , Height = 0}
// writeln('WW=',QWidget_width(QtCheckBox.Widget),' WH=',QWidget_height(QtCheckBox.Widget),' WCW=',AWinControl.Width,' WCH=',AWinControl.Height,' CAPTION=',TCustomCheckBox(AWinControl).Caption);
//QWidget_setFocusPolicy(QtCheckBox.Widget, QtStrongFocus);
// Returns the Handle
Hook := QCheckBox_hook_create(QtCheckBox.Widget);
TEventFilterMethod(Method) := QtCheckBox.EventFilter;
QObject_hook_hook_events(Hook, Method);
QCheckBox_stateChanged_Event(Method) := QtCheckBox.SignalStateChanged;
QCheckBox_hook_hook_stateChanged(QCheckBox_hook_create(QtCheckBox.Widget), Method);
{we must cheat TCustomCheckGroup here with some reasonable CheckBox size...}
if AWinControl.Height = 0 then
AWinControl.SetInitialBounds(0, 0, 100, 20);
Result := THandle(QtCheckBox);
end;
@ -1132,19 +1147,27 @@ class function TQtWSRadioButton.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle;
var
QtRadioButton: TQtRadioButton;
{ Method: TMethod;
Hook : QObject_hookH;}
Method: TMethod;
Hook : QAbstractButton_hookH;
begin
QtRadioButton := TQtRadioButton.Create(AWinControl, AParams);
// Various Events
{ Hook := QObject_hook_create(QtRadioButton.Widget);
Hook := QAbstractButton_hook_create(QtRadioButton.Widget);
TEventFilterMethod(Method) := QtRadioButton.EventFilter;
QObject_hook_hook_events(Hook, Method);}
QObject_hook_hook_events(Hook, Method);
{we must cheat TCustomRadioGroup here with some reasonable RadioButton size...}
if AWinControl.Height = 0 then
AWinControl.SetInitialBounds(0, 0, 100, 20);
QAbstractButton_clicked_Event(Method) := QtRadioButton.SignalClicked;
QAbstractButton_hook_hook_clicked(QAbstractButton_hook_create(QtRadioButton.Widget), Method);
// Focus
//QWidget_setFocusPolicy(QtRadioButton.Widget, QtStrongFocus);
@ -1182,15 +1205,24 @@ class function TQtWSCustomGroupBox.CreateHandle(const AWinControl: TWinControl;
var
QtGroupBox: TQtGroupBox;
Str: WideString;
Method: TMethod;
Hook : QGroupBox_hookH;
begin
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
// If SetSlots is uncommented, then TRadioGroup stops working
// This needs further investigation
// SetSlots(QtButtonGroup);
// This needs further investigation --> Problem is with child controls sizes (zeljko@holobit.net)
// SetSlots(QtButtonGroup);
Hook := QGroupBox_hook_create(QtGroupBox.Widget);
TEventFilterMethod(Method) := QtGroupBox.EventFilter;
QObject_hook_hook_events(Hook, Method);
Str := UTF8Decode(AWinControl.Caption);
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
// LCL doesn't have such features ...
// QGroupBox_setCheckable(QGroupBoxH(QtGroupBox.Widget), True);
// Returns the Handle