Qt: fixed parent assignment inside RecreateWidget(),refactored parent assignment inside CreateWidget(),introduced HwndFromWidgetH() inside qtint so it can be used from other units when we need conversion from QWidgetH to HWND (TQtWidget).

git-svn-id: trunk@23935 -
This commit is contained in:
zeljko 2010-03-11 07:40:29 +00:00
parent 91cf1da6ac
commit 12de1b8c22
2 changed files with 149 additions and 68 deletions

View File

@ -154,6 +154,7 @@ type
pTRect = ^TRect; pTRect = ^TRect;
procedure EventTrace(message : string; data : pointer); procedure EventTrace(message : string; data : pointer);
function HwndFromWidgetH(const WidgetH: QWidgetH): HWND;
const const
@ -235,6 +236,14 @@ begin
end; end;
end; end;
function HwndFromWidgetH(const WidgetH: QWidgetH): HWND;
begin
Result := 0;
if WidgetH = nil then
exit;
Result := HWND(QtObjectFromWidgetH(WidgetH));
end;
function GetFirstQtObjectFromWidgetH(WidgetH: QWidgetH): TQtWidget; function GetFirstQtObjectFromWidgetH(WidgetH: QWidgetH): TQtWidget;
begin begin
Result := nil; Result := nil;

View File

@ -1550,10 +1550,12 @@ begin
FParams.Width := cx; FParams.Width := cx;
FParams.Height := cy; FParams.Height := cy;
end; end;
if Widget <> nil then if Widget <> nil then
Parent := QWidget_parentWidget(Widget) Parent := QWidget_parentWidget(Widget)
else else
Parent := nil; Parent := nil;
FParams.WndParent := HwndFromWidgetH(Parent);
DeinitializeWidget; DeinitializeWidget;
InitializeWidget; InitializeWidget;
end; end;
@ -3961,12 +3963,14 @@ end;
function TQtWidget.CreateWidget(const Params: TCreateParams): QWidgetH; function TQtWidget.CreateWidget(const Params: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
FHasPaint := True; FHasPaint := True;
if Params.WndParent <> 0 then if Params.WndParent <> 0 then
Parent := TQtWidget(Params.WndParent).GetContainerWidget; Parent := TQtWidget(Params.WndParent).GetContainerWidget
else
Parent := nil;
Widget := QWidget_create(Parent); Widget := QWidget_create(Parent);
Result := Widget; Result := Widget;
@ -4152,10 +4156,12 @@ end;
function TQtPushButton.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtPushButton.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QPushButton_create(Parent); Result := QPushButton_create(Parent);
end; end;
@ -4245,7 +4251,7 @@ function TQtMainWindow.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
w: QWidgetH; w: QWidgetH;
p: QPaletteH; p: QPaletteH;
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -4316,7 +4322,9 @@ begin
else else
begin begin
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
if (TCustomForm(LCLObject).FormStyle = fsSplash) and if (TCustomForm(LCLObject).FormStyle = fsSplash) and
not (csDesigning in LCLObject.ComponentState) then not (csDesigning in LCLObject.ComponentState) then
@ -4651,7 +4659,7 @@ end;
function TQtStaticText.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtStaticText.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -4659,7 +4667,9 @@ begin
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QLabel_create(Parent); Result := QLabel_create(Parent);
end; end;
@ -4708,7 +4718,7 @@ end;
function TQtCheckBox.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtCheckBox.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -4717,7 +4727,9 @@ begin
TextColorRole := QPaletteWindowText; TextColorRole := QPaletteWindowText;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QCheckBox_create(Parent); Result := QCheckBox_create(Parent);
end; end;
@ -4773,7 +4785,7 @@ end;
function TQtRadioButton.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtRadioButton.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -4781,7 +4793,9 @@ begin
{$endif} {$endif}
TextColorRole := QPaletteWindowText; TextColorRole := QPaletteWindowText;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QRadioButton_create(Parent); Result := QRadioButton_create(Parent);
// hide widget by default // hide widget by default
QWidget_hide(Result); QWidget_hide(Result);
@ -4849,7 +4863,7 @@ end;
function TQtGroupBox.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtGroupBox.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Layout: QBoxLayoutH; Layout: QBoxLayoutH;
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -4857,7 +4871,9 @@ begin
{$endif} {$endif}
FHasPaint := True; FHasPaint := True;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QGroupBox_create(Parent); Result := QGroupBox_create(Parent);
FCentralWidget := QStackedWidget_create(Result); FCentralWidget := QStackedWidget_create(Result);
{we set QtNoFocus by default, since we don't want {we set QtNoFocus by default, since we don't want
@ -4910,7 +4926,7 @@ end;
function TQtFrame.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtFrame.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -4918,7 +4934,9 @@ begin
{$endif} {$endif}
FHasPaint := True; FHasPaint := True;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QFrame_create(Parent); Result := QFrame_create(Parent);
QWidget_setAutoFillBackground(Result, True); QWidget_setAutoFillBackground(Result, True);
QWidget_setAttribute(Result, QtWA_NoMousePropagation); QWidget_setAttribute(Result, QtWA_NoMousePropagation);
@ -4969,7 +4987,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TQtArrow.CreateWidget(const AParams: TCreateParams):QWidgetH; function TQtArrow.CreateWidget(const AParams: TCreateParams):QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -4977,14 +4995,16 @@ begin
{$endif} {$endif}
FHasPaint := True; FHasPaint := True;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QFrame_create(Parent); Result := QFrame_create(Parent);
QWidget_setAttribute(Result, QtWA_NoMousePropagation); QWidget_setAttribute(Result, QtWA_NoMousePropagation);
end; end;
function TQtAbstractSlider.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtAbstractSlider.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -4995,7 +5015,9 @@ begin
FSliderReleased:= False; FSliderReleased:= False;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QAbstractSlider_create(Parent); Result := QAbstractSlider_create(Parent);
end; end;
@ -5369,7 +5391,9 @@ begin
WriteLn('TQtScrollBar.Create'); WriteLn('TQtScrollBar.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QScrollBar_create(Parent); Result := QScrollBar_create(Parent);
QWidget_setFocusPolicy(Result, QtNoFocus); QWidget_setFocusPolicy(Result, QtNoFocus);
QWidget_setAutoFillBackground(Result, True); QWidget_setAutoFillBackground(Result, True);
@ -5446,7 +5470,9 @@ begin
WriteLn('TQtToolBar.Create'); WriteLn('TQtToolBar.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QToolBar_create(Parent); Result := QToolBar_create(Parent);
end; end;
@ -5454,14 +5480,16 @@ end;
function TQtToolButton.CreateWidget(const AParams: TCreateParams):QWidgetH; function TQtToolButton.CreateWidget(const AParams: TCreateParams):QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtToolButton.Create'); WriteLn('TQtToolButton.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QToolButton_create(Parent); Result := QToolButton_create(Parent);
end; end;
@ -5469,14 +5497,16 @@ end;
function TQtTrackBar.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtTrackBar.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtTrackBar.Create'); WriteLn('TQtTrackBar.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QSlider_create(Parent); Result := QSlider_create(Parent);
end; end;
@ -5553,10 +5583,12 @@ end;
function TQtLineEdit.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtLineEdit.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QLineEdit_create(Parent); Result := QLineEdit_create(Parent);
end; end;
@ -5722,14 +5754,16 @@ end;
function TQtTextEdit.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtTextEdit.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtTextEdit.Create'); WriteLn('TQtTextEdit.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QTextEdit_create(Parent); Result := QTextEdit_create(Parent);
FKeysToEat := []; FKeysToEat := [];
FUndoAvailable := False; FUndoAvailable := False;
@ -6083,14 +6117,16 @@ end;
function TQtTabWidget.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtTabWidget.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtTabWidget.Create'); WriteLn('TQtTabWidget.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QTabWidget_create(Parent); Result := QTabWidget_create(Parent);
{note: for some reason tabbar scroll buttons are not enabled as default option {note: for some reason tabbar scroll buttons are not enabled as default option
@ -6351,7 +6387,7 @@ end;
function TQtComboBox.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtComboBox.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -6359,7 +6395,9 @@ begin
{$endif} {$endif}
FDropListVisibleInternal := False; FDropListVisibleInternal := False;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QComboBox_create(Parent); Result := QComboBox_create(Parent);
// disable AutoCompletion. LCL has its own // disable AutoCompletion. LCL has its own
QComboBox_setAutoCompletion(QComboboxH(Result), False); QComboBox_setAutoCompletion(QComboboxH(Result), False);
@ -6845,14 +6883,16 @@ end;
function TQtAbstractSpinBox.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtAbstractSpinBox.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtAbstractSpinBox.Create'); WriteLn('TQtAbstractSpinBox.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QAbstractSpinBox_create(Parent); Result := QAbstractSpinBox_create(Parent);
end; end;
@ -7018,7 +7058,7 @@ end;
function TQtFloatSpinBox.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtFloatSpinBox.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -7029,7 +7069,9 @@ begin
FParentShowPassed := 0; FParentShowPassed := 0;
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QDoubleSpinBox_create(Parent); Result := QDoubleSpinBox_create(Parent);
end; end;
@ -7114,14 +7156,16 @@ end;
function TQtSpinBox.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtSpinBox.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtSpinBox.Create'); WriteLn('TQtSpinBox.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QSpinBox_create(Parent); Result := QSpinBox_create(Parent);
end; end;
@ -7175,12 +7219,14 @@ end;
function TQtListWidget.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtListWidget.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
FCheckable := False; FCheckable := False;
FDontPassSelChange := False; FDontPassSelChange := False;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QListWidget_create(Parent); Result := QListWidget_create(Parent);
QWidget_setAttribute(Result, QtWA_NoMousePropagation); QWidget_setAttribute(Result, QtWA_NoMousePropagation);
end; end;
@ -7561,14 +7607,16 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TQtHeaderView.CreateWidget(const AParams: TCreateParams):QWidgetH; function TQtHeaderView.CreateWidget(const AParams: TCreateParams):QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtHeaderView.Create'); WriteLn('TQtHeaderView.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QHeaderView_create(QtHorizontal, Parent); Result := QHeaderView_create(QtHorizontal, Parent);
end; end;
@ -7699,14 +7747,16 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TQtTreeView.CreateWidget(const AParams: TCreateParams):QWidgetH; function TQtTreeView.CreateWidget(const AParams: TCreateParams):QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtTreeView.Create'); WriteLn('TQtTreeView.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QTreeView_create(Parent); Result := QTreeView_create(Parent);
end; end;
@ -7719,7 +7769,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TQtTreeWidget.CreateWidget(const AParams: TCreateParams):QWidgetH; function TQtTreeWidget.CreateWidget(const AParams: TCreateParams):QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -7730,7 +7780,9 @@ begin
FSyncingItems := False; FSyncingItems := False;
FSorting := False; FSorting := False;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QTreeWidget_create(Parent); Result := QTreeWidget_create(Parent);
FHeader := nil; FHeader := nil;
QWidget_setAttribute(Result, QtWA_NoMousePropagation); QWidget_setAttribute(Result, QtWA_NoMousePropagation);
@ -8463,14 +8515,16 @@ end;
function TQtTableView.CreateWidget(const Params: TCreateParams): QWidgetH; function TQtTableView.CreateWidget(const Params: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtTableView.CreateWidget'); WriteLn('TQtTableView.CreateWidget');
{$endif} {$endif}
HasPaint := False; HasPaint := False;
if Params.WndParent <> 0 then if Params.WndParent <> 0 then
Parent := TQtWidget(Params.WndParent).GetContainerWidget; Parent := TQtWidget(Params.WndParent).GetContainerWidget
else
Parent := nil;
Result := QTableView_create(Parent); Result := QTableView_create(Parent);
QWidget_setAutoFillBackground(Result, True); QWidget_setAutoFillBackground(Result, True);
end; end;
@ -8539,12 +8593,14 @@ end;
function TQtMenu.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtMenu.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
AGroup: TQtActionGroup; AGroup: TQtActionGroup;
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
FTrackButton := QtNoButton; FTrackButton := QtNoButton;
FIcon := nil; FIcon := nil;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QMenu_create(Parent); Result := QMenu_create(Parent);
FDeleteLater := True; FDeleteLater := True;
FActionHandle := nil; FActionHandle := nil;
@ -8931,14 +8987,16 @@ end;
function TQtProgressBar.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtProgressBar.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQProgressBar.Create'); WriteLn('TQProgressBar.Create');
{$endif} {$endif}
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QProgressBar_create(Parent); Result := QProgressBar_create(Parent);
QWidget_setAttribute(Result, QtWA_NoMousePropagation, True); QWidget_setAttribute(Result, QtWA_NoMousePropagation, True);
end; end;
@ -9010,11 +9068,13 @@ end;
function TQtStatusBar.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtStatusBar.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
SetLength(Panels, 0); SetLength(Panels, 0);
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QStatusBar_create(Parent); Result := QStatusBar_create(Parent);
QWidget_setAutoFillBackground(Result, True); QWidget_setAutoFillBackground(Result, True);
Widget := Result; Widget := Result;
@ -9342,7 +9402,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TQtCustomControl.CreateWidget(const AParams: TCreateParams):QWidgetH; function TQtCustomControl.CreateWidget(const AParams: TCreateParams):QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -9351,7 +9411,9 @@ begin
FHasPaint := True; FHasPaint := True;
FViewPortWidget := nil; FViewPortWidget := nil;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QLCLAbstractScrollArea_create(Parent); Result := QLCLAbstractScrollArea_create(Parent);
FFrameOnlyAroundContents := QStyle_styleHint(QApplication_style(), FFrameOnlyAroundContents := QStyle_styleHint(QApplication_style(),
@ -9617,7 +9679,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TQtCalendar.CreateWidget(const AParams: TCreateParams):QWidgetH; function TQtCalendar.CreateWidget(const AParams: TCreateParams):QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -9625,7 +9687,9 @@ begin
{$endif} {$endif}
FMouseDoubleClicked := False; FMouseDoubleClicked := False;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QCalendarWidget_create(Parent); Result := QCalendarWidget_create(Parent);
end; end;
@ -9898,11 +9962,13 @@ end;
function TQtHintWindow.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtHintWindow.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
FHasPaint := True; FHasPaint := True;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QWidget_create(Parent, QtToolTip); Result := QWidget_create(Parent, QtToolTip);
FDeleteLater := True; FDeleteLater := True;
MenuBar := nil; MenuBar := nil;
@ -9918,11 +9984,13 @@ end;
function TQtPage.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtPage.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
FHasPaint := True; FHasPaint := True;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QWidget_create(Parent); Result := QWidget_create(Parent);
QWidget_setAutoFillBackground(Result, True); QWidget_setAutoFillBackground(Result, True);
QWidget_setAttribute(Result, QtWA_NoMousePropagation); QWidget_setAttribute(Result, QtWA_NoMousePropagation);
@ -10204,10 +10272,12 @@ end;
function TQtRubberBand.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtRubberBand.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QRubberBand_create(FShape, Parent); Result := QRubberBand_create(FShape, Parent);
end; end;
@ -10380,11 +10450,13 @@ end;
function TQtGraphicsView.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtGraphicsView.CreateWidget(const AParams: TCreateParams): QWidgetH;
var var
Parent: QWidgetH = nil; Parent: QWidgetH;
begin begin
FHasPaint := True; FHasPaint := True;
if AParams.WndParent <> 0 then if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget; Parent := TQtWidget(AParams.WndParent).GetContainerWidget
else
Parent := nil;
Result := QGraphicsView_create(Parent); Result := QGraphicsView_create(Parent);
QWidget_setAttribute(Result, QtWA_NoMousePropagation); QWidget_setAttribute(Result, QtWA_NoMousePropagation);
end; end;