mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 00:40:18 +02:00
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:
parent
67e41ef9dd
commit
e4c54c9f40
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user