Qt: fixed hang with TScrollingWinControl until TQtMainWindow reworked (form scrollbars)

git-svn-id: trunk@25403 -
This commit is contained in:
zeljko 2010-05-14 15:56:46 +00:00
parent 847f100e73
commit db0addae35

View File

@ -52,7 +52,9 @@ type
TChildOfComplexWidget = (ccwNone, TChildOfComplexWidget = (ccwNone,
ccwComboBox, ccwComboBox,
ccwTreeWidget, ccwTreeWidget,
ccwAbstractScrollArea); ccwAbstractScrollArea,
ccwScrollingWinControl);
TQtGroupBoxType = (tgbtNormal, TQtGroupBoxType = (tgbtNormal,
tgbtCheckGroup, tgbtCheckGroup,
tgbtRadioGroup); tgbtRadioGroup);
@ -10412,25 +10414,21 @@ end;
function TQtViewPort.CanPaintBackground: Boolean; function TQtViewPort.CanPaintBackground: Boolean;
begin begin
Result := CanSendLCLMessage and getEnabled and Result := CanSendLCLMessage and getEnabled and
(LCLObject is TScrollingWinControl) and (FChildOfComplexWidget = ccwScrollingWinControl) and
(LCLObject.Color <> clBtnFace) and (LCLObject.Color <> clBackground); (LCLObject.Color <> clBtnFace) and (LCLObject.Color <> clBackground);
end; end;
function TQtViewPort.EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; function TQtViewPort.EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl;
begin begin
Result := False;
case QEvent_type(Event) of case QEvent_type(Event) of
QEventWheel: Result := False;
QEventResize: QEventResize:
begin begin
Result := False;
// immediate update clientRect ! // immediate update clientRect !
LCLObject.DoAdjustClientRectChange; LCLObject.DoAdjustClientRectChange;
end; end;
QEventLayoutRequest: QEventLayoutRequest,
begin QEventWheel: ; // nothing to do here
{TODO: something here (maybe) }
Result := False;
end;
else else
Result := inherited EventFilter(Sender, Event); Result := inherited EventFilter(Sender, Event);
end; end;
@ -10641,7 +10639,7 @@ var
begin begin
// Creates the widget // Creates the widget
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQtCustomControl.Create'); WriteLn('TQtCustomControl.CreateWidget');
{$endif} {$endif}
FHasPaint := True; FHasPaint := True;
FViewPortWidget := nil; FViewPortWidget := nil;
@ -10655,10 +10653,12 @@ begin
FFrameOnlyAroundContents := QStyle_styleHint(QApplication_style(), FFrameOnlyAroundContents := QStyle_styleHint(QApplication_style(),
QStyleSH_ScrollView_FrameOnlyAroundContents) > 0; QStyleSH_ScrollView_FrameOnlyAroundContents) > 0;
if not (csDesigning in LCLObject.ComponentState) and if (LCLObject is TScrollingWinControl) then
(LCLObject is TScrollingWinControl) then begin
QWidget_setAutoFillBackground(Result, True) if not (csDesigning in LCLObject.ComponentState) then
else QWidget_setAutoFillBackground(Result, True);
FChildOfComplexWidget := ccwScrollingWinControl;
end else
QWidget_setAutoFillBackground(Result, False); QWidget_setAutoFillBackground(Result, False);
QWidget_setAttribute(Result, QtWA_NoMousePropagation); QWidget_setAttribute(Result, QtWA_NoMousePropagation);
@ -10673,7 +10673,7 @@ end;
destructor TQtCustomControl.Destroy; destructor TQtCustomControl.Destroy;
begin begin
{$ifdef VerboseQt} {$ifdef VerboseQt}
WriteLn('TQAbstractScrollArea.Destroy'); WriteLn('TQtCustomControl.Destroy');
{$endif} {$endif}
viewportDelete; viewportDelete;
inherited Destroy; inherited Destroy;
@ -10755,7 +10755,12 @@ begin
retval^ := True; retval^ := True;
if FResizing and (QEvent_type(Event) = QEventResize) then if FResizing and (QEvent_type(Event) = QEventResize) then
FResizing := False; FResizing := False;
Viewport.EventFilter(ViewPort.Widget, Event);
if (QEvent_type(Event) = QEventResize) and
(FChildOfComplexWidget = ccwScrollingWinControl) then
//do nothing for TScrollingWinControl otherwise we are hanging.
else
Viewport.EventFilter(ViewPort.Widget, Event);
// do not allow qt to call notifications on user input events (mouse) // do not allow qt to call notifications on user input events (mouse)
// otherwise we can crash since our object maybe does not exist // otherwise we can crash since our object maybe does not exist
// after mouse clicks // after mouse clicks
@ -10907,6 +10912,7 @@ begin
FViewPortWidget.setBackgroundRole(QPaletteNoRole); FViewPortWidget.setBackgroundRole(QPaletteNoRole);
FViewPortWidget.setAutoFillBackground(False); FViewPortWidget.setAutoFillBackground(False);
FViewPortWidget.FOwner := Self; FViewPortWidget.FOwner := Self;
FViewPortWidget.FChildOfComplexWidget := FChildOfComplexWidget;
// some events will be redirected to scroll area // some events will be redirected to scroll area
FViewPortWidget.AttachEvents; FViewPortWidget.AttachEvents;