QT+GTK2: Fix TFloatSpinEdit not being unconstrained when MinValue = MaxValue. Issue #29645

git-svn-id: branches/fixes_1_6@51621 -
This commit is contained in:
mattias 2016-02-14 09:08:06 +00:00
parent 67e41ef9dd
commit e4c54c9f40
2 changed files with 23 additions and 6 deletions

View File

@ -155,8 +155,16 @@ begin
end
else
begin
AnAdjustment^.lower := TCustomFloatSpinEdit(ACustomEdit).MinValue;
AnAdjustment^.upper := TCustomFloatSpinEdit(ACustomEdit).MaxValue;
if (TCustomFloatSpinEdit(ACustomEdit).MaxValue > TCustomFloatSpinEdit(ACustomEdit).MinValue) then
begin
AnAdjustment^.lower := TCustomFloatSpinEdit(ACustomEdit).MinValue;
AnAdjustment^.upper := TCustomFloatSpinEdit(ACustomEdit).MaxValue;
end
else
begin
AnAdjustment^.lower := -MaxDouble;
AnAdjustment^.upper := MaxDouble;
end;
end;
gtk_spin_button_update(GTK_SPIN_BUTTON(Widget));
end;
@ -175,7 +183,7 @@ begin
wHandle := ACustomFloatSpinEdit.Handle;
SpinWidget:=GTK_SPIN_BUTTON({%H-}Pointer(wHandle));
if ACustomFloatSpinEdit.MaxValue >= ACustomFloatSpinEdit.MinValue then
if ACustomFloatSpinEdit.MaxValue > ACustomFloatSpinEdit.MinValue then
begin
AMin := ACustomFloatSpinEdit.MinValue;
AMax := ACustomFloatSpinEdit.MaxValue;

View File

@ -28,6 +28,8 @@ uses
qtwidgets,
// LCL
Spin, SysUtils, Controls, Classes, LCLType, LCLProc, LCLIntf, Forms, StdCtrls,
//RTL
Math,
// Widgetset
WsProc, WSSpin, WSLCLClasses;
@ -69,9 +71,16 @@ begin
try
if ASpinWidget is TQtFloatSpinBox then
TQtFloatSpinBox(ASpinWidget).setDecimals(ACustomFloatSpinEdit.DecimalPlaces);
ASpinWidget.setMinimum(ACustomFloatSpinEdit.MinValue);
ASpinWidget.setMaximum(ACustomFloatSpinEdit.MaxValue);
if (ACustomFloatSpinEdit.MaxValue > ACustomFloatSpinEdit.MinValue) then
begin
ASpinWidget.setMinimum(ACustomFloatSpinEdit.MinValue);
ASpinWidget.setMaximum(ACustomFloatSpinEdit.MaxValue);
end
else
begin
ASpinWidget.setMinimum(-MaxDouble);
ASpinWidget.setMaximum(MaxDouble);
end;
ASpinWidget.setSingleStep(ACustomFloatSpinEdit.Increment);
finally
ASpinWidget.EndUpdate;