Luca Olivetti via Lazarus
2018-06-11 09:14:24 UTC
Lazarus 1.8.4, FPC 3.0.4, x86_64-linux-qt5
In a spinedit, if I set maxvalue and minvalue to 0, the spinedit doesn't
work with the qt5 widgetset.
I see that in qtswsspin.pp
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;
so at first sight it seems it should work, but the implementation of
setMinimum and setMaximum is
procedure TQtSpinBox.setMinimum(const v: Double);
begin
QSpinBox_setMinimum(QSpinBoxH(Widget), round(v));
end;
procedure TQtSpinBox.setMaximum(const v: Double);
begin
QSpinBox_setMaximum(QSpinBoxH(Widget), round(v));
end;
and, while round(-MaxDouble) works, round(MaxDouble) silently fails
(linux/x64, it gives an FPE exception under win32).
There's no such problem with gtk2 because the underlying widget is
floating point based.
Bye
In a spinedit, if I set maxvalue and minvalue to 0, the spinedit doesn't
work with the qt5 widgetset.
I see that in qtswsspin.pp
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;
so at first sight it seems it should work, but the implementation of
setMinimum and setMaximum is
procedure TQtSpinBox.setMinimum(const v: Double);
begin
QSpinBox_setMinimum(QSpinBoxH(Widget), round(v));
end;
procedure TQtSpinBox.setMaximum(const v: Double);
begin
QSpinBox_setMaximum(QSpinBoxH(Widget), round(v));
end;
and, while round(-MaxDouble) works, round(MaxDouble) silently fails
(linux/x64, it gives an FPE exception under win32).
There's no such problem with gtk2 because the underlying widget is
floating point based.
Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007
--