Qt: QDoubleSpinBox, QSpinBox do not deliver messages if InUpdate().

git-svn-id: trunk@22078 -
This commit is contained in:
zeljko 2009-10-08 16:27:36 +00:00
parent c96137c619
commit 8915c4816d
2 changed files with 23 additions and 10 deletions

View File

@ -6599,6 +6599,9 @@ begin
QLineEdit_text(LineEdit, @Result) QLineEdit_text(LineEdit, @Result)
else else
Result := ''; Result := '';
{$ifdef VerboseQt}
WriteLn('TQtAbstractSpinBox.GetText Result=',Result);
{$endif}
end; end;
function TQtAbstractSpinBox.getTextStatic: Boolean; function TQtAbstractSpinBox.getTextStatic: Boolean;
@ -6619,6 +6622,9 @@ end;
procedure TQtAbstractSpinBox.setText(const W: WideString); procedure TQtAbstractSpinBox.setText(const W: WideString);
begin begin
{$ifdef VerboseQt}
WriteLn('TQtAbstractSpinBox.SetText W=',w);
{$endif}
if (LineEdit <> nil) then if (LineEdit <> nil) then
QLineEdit_setText(LineEdit, @W) QLineEdit_setText(LineEdit, @W)
end; end;
@ -6653,8 +6659,8 @@ begin
press TabKey to select next control, but if we press TabKey to select next control, but if we
connect OnKeyDown and say eg. VK_RETURN: SelectNext(ActiveControl, true, true) connect OnKeyDown and say eg. VK_RETURN: SelectNext(ActiveControl, true, true)
then spinedit text is always selected, nothing important but looks ugly.} then spinedit text is always selected, nothing important but looks ugly.}
// Msg.Msg := LM_EXIT; // Msg.Msg := LM_EXIT;
// DeliverMessage(Msg); // DeliverMessage(Msg);
end; end;
{ TQtFloatSpinBox } { TQtFloatSpinBox }
@ -6717,7 +6723,8 @@ var
begin begin
FillChar(Msg, SizeOf(Msg), #0); FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := CM_TEXTCHANGED; Msg.Msg := CM_TEXTCHANGED;
DeliverMessage(Msg); if not InUpdate then
DeliverMessage(Msg);
end; end;
{ TQtSpinBox } { TQtSpinBox }
@ -6775,7 +6782,8 @@ var
begin begin
FillChar(Msg, SizeOf(Msg), #0); FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := CM_TEXTCHANGED; Msg.Msg := CM_TEXTCHANGED;
DeliverMessage(Msg); if not InUpdate then
DeliverMessage(Msg);
end; end;
function TQtListWidget.CreateWidget(const AParams: TCreateParams): QWidgetH; function TQtListWidget.CreateWidget(const AParams: TCreateParams): QWidgetH;

View File

@ -70,13 +70,18 @@ class procedure TQtWSCustomFloatSpinEdit.InternalUpdateControl(
const ASpinWidget: TQtAbstractSpinBox; const ASpinWidget: TQtAbstractSpinBox;
const ACustomFloatSpinEdit: TCustomFloatSpinEdit); const ACustomFloatSpinEdit: TCustomFloatSpinEdit);
begin begin
if ASpinWidget is TQtFloatSpinBox then ASpinWidget.BeginUpdate;
TQtFloatSpinBox(ASpinWidget).setDecimals(ACustomFloatSpinEdit.DecimalPlaces); try
if ASpinWidget is TQtFloatSpinBox then
TQtFloatSpinBox(ASpinWidget).setDecimals(ACustomFloatSpinEdit.DecimalPlaces);
ASpinWidget.setValue(ACustomFloatSpinEdit.Value); ASpinWidget.setValue(ACustomFloatSpinEdit.Value);
ASpinWidget.setMinimum(ACustomFloatSpinEdit.MinValue); ASpinWidget.setMinimum(ACustomFloatSpinEdit.MinValue);
ASpinWidget.setMaximum(ACustomFloatSpinEdit.MaxValue); ASpinWidget.setMaximum(ACustomFloatSpinEdit.MaxValue);
ASpinWidget.setSingleStep(ACustomFloatSpinEdit.Increment); ASpinWidget.setSingleStep(ACustomFloatSpinEdit.Increment);
finally
ASpinWidget.EndUpdate;
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------