diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-05-11 16:03:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-05-11 21:39:21 +0200 |
commit | 4ae776b842a8b6f065206d3250113493fd688756 (patch) | |
tree | 67b32f2306cb4c8db91c36bd72b902d6c9faa0bc /vcl/unx | |
parent | c8cb7a658b33e296024044f3377378644a9a97ef (diff) |
tdf#155241 keep current MetricSpinButton value if unparseable junk input
Change-Id: I0f13c9ae25c1788924fd81ed77307e96400f6220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151677
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 0106507edad6..adea2d9a7c10 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -17494,6 +17494,11 @@ public: m_aCustomFont.use_custom_font(&rFont, u"spinbutton"); } + void set_update_policy_if_valid() + { + gtk_spin_button_set_update_policy(m_pButton, GTK_UPDATE_IF_VALID); + } + virtual void disable_notify_events() override { g_signal_handler_block(m_pButton, m_nValueChangedSignalId); @@ -24323,7 +24328,13 @@ public: virtual std::unique_ptr<weld::MetricSpinButton> weld_metric_spin_button(const OUString& id, FieldUnit eUnit) override { - return std::make_unique<weld::MetricSpinButton>(weld_spin_button(id), eUnit); + std::unique_ptr<weld::SpinButton> xButton(weld_spin_button(id)); + if (xButton) + { + GtkInstanceSpinButton& rButton = dynamic_cast<GtkInstanceSpinButton&>(*xButton); + rButton.set_update_policy_if_valid(); + } + return std::make_unique<weld::MetricSpinButton>(std::move(xButton), eUnit); } virtual std::unique_ptr<weld::FormattedSpinButton> weld_formatted_spin_button(const OUString &id) override |