starmath/uiconfig/smath/ui/fontsizedialog.ui | 291 +++++++++++++-------------- vcl/inc/qt5/QtDoubleSpinBox.hxx | 7 vcl/inc/qt5/QtInstanceSpinButton.hxx | 1 vcl/qt5/QtDoubleSpinBox.cxx | 22 +- vcl/qt5/QtInstanceFormattedSpinButton.cxx | 12 - vcl/qt5/QtInstanceSpinButton.cxx | 15 - 6 files changed, 178 insertions(+), 170 deletions(-)
New commits: commit f57b11457c7dc7c9be44d4406b39b49a829cdabe Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 4 14:56:55 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 4 19:27:33 2025 +0200 tdf#130857 Define widgets in math "Font Sizes" dlg in order Switch the order in which the widgets in the .ui file are defined so that the order matches the visual appearance (and "left-attach"/"top-attach" properties order), which makes sure that tab focus order with the Qt-based VCL plugins is correct as well when using native Qt widgets (SAL_VCL_QT_USE_WELDED_WIDGETS=1), where focus order is (by default) based on widget creation order. See commit 02692566ad9fc7c3484f8581ffa0004cd4e43987 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Thu Oct 24 17:43:35 2024 +0200 tdf#130857 optnewdictionarydialog.ui: Define focusable widgets in order for more background. The dialog can be triggered in Math via "Format" -> "Font Size". Change-Id: I9b0286d3329671632269649a461df52b855128b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183715 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/starmath/uiconfig/smath/ui/fontsizedialog.ui b/starmath/uiconfig/smath/ui/fontsizedialog.ui index 5dde406c2e01..21ab72fe2a0f 100644 --- a/starmath/uiconfig/smath/ui/fontsizedialog.ui +++ b/starmath/uiconfig/smath/ui/fontsizedialog.ui @@ -202,168 +202,168 @@ <property name="row-spacing">6</property> <property name="column-spacing">12</property> <child> - <object class="GtkSpinButton" id="spinB_function"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hexpand">True</property> - <property name="activates-default">True</property> - <property name="truncate-multiline">True</property> - <property name="adjustment">adjustmentRelativeSizes1</property> - <child internal-child="accessible"> - <object class="AtkObject" id="spinB_function-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_function">Select the relative size for names and other function elements in a formula in proportion to the base size.</property> - </object> - </child> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes" context="fontsizedialog|label2">_Operators:</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">spinB_operator</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> + <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="label" translatable="yes" context="fontsizedialog|label3">_Limits:</property> + <property name="label" translatable="yes" context="fontsizedialog|label5">_Text:</property> <property name="use-underline">True</property> - <property name="mnemonic-widget">spinB_limit</property> + <property name="mnemonic-widget">spinB_text</property> <property name="xalign">0</property> </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">4</property> + <property name="top-attach">0</property> </packing> </child> <child> - <object class="GtkSpinButton" id="spinB_operator"> + <object class="GtkSpinButton" id="spinB_text"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="activates-default">True</property> <property name="truncate-multiline">True</property> - <property name="adjustment">adjustmentRelativeSizes2</property> + <property name="adjustment">adjustmentRelativeSizes4</property> <child internal-child="accessible"> - <object class="AtkObject" id="spinB_operator-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_operator">Select the relative size of the mathematical operators in a formula in proportion to the base size.</property> + <object class="AtkObject" id="spinB_text-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_text">Select the size for text in a formula relative to the base size.</property> </object> </child> </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">3</property> + <property name="top-attach">0</property> </packing> </child> <child> - <object class="GtkSpinButton" id="spinB_limit"> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="fontsizedialog|label6">_Indexes:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">spinB_index</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="spinB_index"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="activates-default">True</property> <property name="truncate-multiline">True</property> - <property name="adjustment">adjustmentRelativeSizes3</property> + <property name="adjustment">adjustmentRelativeSizes5</property> <child internal-child="accessible"> - <object class="AtkObject" id="spinB_limit-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_limit">Select the relative size for the limits in a formula in proportion to the base size.</property> + <object class="AtkObject" id="spinB_index-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_index">Select the relative size for the indexes in a formula in proportion to the base size.</property> </object> </child> </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">4</property> + <property name="top-attach">1</property> </packing> </child> <child> - <object class="GtkLabel" id="label5"> + <object class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="label" translatable="yes" context="fontsizedialog|label5">_Text:</property> + <property name="label" translatable="yes" context="fontsizedialog|label7">_Functions:</property> <property name="use-underline">True</property> - <property name="mnemonic-widget">spinB_text</property> + <property name="mnemonic-widget">spinB_function</property> <property name="xalign">0</property> </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> - <object class="GtkLabel" id="label7"> + <object class="GtkSpinButton" id="spinB_function"> <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes" context="fontsizedialog|label7">_Functions:</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">spinB_function</property> - <property name="xalign">0</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="activates-default">True</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustmentRelativeSizes1</property> + <child internal-child="accessible"> + <object class="AtkObject" id="spinB_function-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_function">Select the relative size for names and other function elements in a formula in proportion to the base size.</property> + </object> + </child> </object> <packing> - <property name="left-attach">0</property> + <property name="left-attach">1</property> <property name="top-attach">2</property> </packing> </child> <child> - <object class="GtkLabel" id="label6"> + <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="label" translatable="yes" context="fontsizedialog|label6">_Indexes:</property> + <property name="label" translatable="yes" context="fontsizedialog|label2">_Operators:</property> <property name="use-underline">True</property> - <property name="mnemonic-widget">spinB_index</property> + <property name="mnemonic-widget">spinB_operator</property> <property name="xalign">0</property> </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">1</property> + <property name="top-attach">3</property> </packing> </child> <child> - <object class="GtkSpinButton" id="spinB_text"> + <object class="GtkSpinButton" id="spinB_operator"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="activates-default">True</property> <property name="truncate-multiline">True</property> - <property name="adjustment">adjustmentRelativeSizes4</property> + <property name="adjustment">adjustmentRelativeSizes2</property> <child internal-child="accessible"> - <object class="AtkObject" id="spinB_text-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_text">Select the size for text in a formula relative to the base size.</property> + <object class="AtkObject" id="spinB_operator-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_operator">Select the relative size of the mathematical operators in a formula in proportion to the base size.</property> </object> </child> </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> - <object class="GtkSpinButton" id="spinB_index"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="fontsizedialog|label3">_Limits:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">spinB_limit</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">4</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="spinB_limit"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="activates-default">True</property> <property name="truncate-multiline">True</property> - <property name="adjustment">adjustmentRelativeSizes5</property> + <property name="adjustment">adjustmentRelativeSizes3</property> <child internal-child="accessible"> - <object class="AtkObject" id="spinB_index-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_index">Select the relative size for the indexes in a formula in proportion to the base size.</property> + <object class="AtkObject" id="spinB_limit-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_limit">Select the relative size for the limits in a formula in proportion to the base size.</property> </object> </child> </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">1</property> + <property name="top-attach">4</property> </packing> </child> </object> commit c82b58e9ca2ceaf90561f3f1e3d6b46c89a84442 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 4 14:50:44 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 4 19:27:26 2025 +0200 math: Resave fontsizedialog.ui with glade 3.40 This is the "Format" -> "Font Size" dialog in Math. Change-Id: I152f6f7ad4ebd2d4433485ebd266255f97e1da43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183714 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/starmath/uiconfig/smath/ui/fontsizedialog.ui b/starmath/uiconfig/smath/ui/fontsizedialog.ui index 37ead0b4a003..5dde406c2e01 100644 --- a/starmath/uiconfig/smath/ui/fontsizedialog.ui +++ b/starmath/uiconfig/smath/ui/fontsizedialog.ui @@ -1,68 +1,68 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.40.0 --> <interface domain="sm"> <requires lib="gtk+" version="3.20"/> <object class="GtkAdjustment" id="adjustmentBaseSize"> <property name="lower">4</property> <property name="upper">127</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustmentRelativeSizes1"> <property name="lower">5</property> <property name="upper">200</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustmentRelativeSizes2"> <property name="lower">5</property> <property name="upper">200</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustmentRelativeSizes3"> <property name="lower">5</property> <property name="upper">200</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustmentRelativeSizes4"> <property name="lower">5</property> <property name="upper">200</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustmentRelativeSizes5"> <property name="lower">5</property> <property name="upper">200</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkDialog" id="FontSizeDialog"> - <property name="can_focus">False</property> - <property name="border_width">6</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> <property name="title" translatable="yes" context="fontsizedialog|FontSizeDialog">Font Sizes</property> <property name="resizable">False</property> <property name="modal">True</property> - <property name="default_width">0</property> - <property name="default_height">0</property> - <property name="type_hint">dialog</property> + <property name="default-width">0</property> + <property name="default-height">0</property> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox4"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area4"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="can-focus">False</property> + <property name="layout-style">end</property> <child> <object class="GtkButton" id="default"> <property name="label" translatable="yes" context="fontsizedialog|default">_Default</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> <child internal-child="accessible"> <object class="AtkObject" id="default-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|default">Click this button to save your changes as a default for all new formulas.</property> @@ -79,10 +79,10 @@ <object class="GtkButton" id="ok"> <property name="label" translatable="yes" context="stock">_OK</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -95,8 +95,8 @@ <object class="GtkButton" id="cancel"> <property name="label" translatable="yes" context="stock">_Cancel</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -109,8 +109,8 @@ <object class="GtkButton" id="help"> <property name="label" translatable="yes" context="stock">_Help</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -124,31 +124,31 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkBox" id="box1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkBox" id="box2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> + <property name="margin-start">12</property> <property name="hexpand">True</property> <property name="spacing">12</property> - <property name="margin-start">12</property> <child> <object class="GtkLabel" id="label4"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="fontsizedialog|label4">Base _size:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">spinB_baseSize</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">spinB_baseSize</property> <property name="xalign">0</property> </object> <packing> @@ -160,11 +160,11 @@ <child> <object class="GtkSpinButton" id="spinB_baseSize"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> - <property name="adjustment">adjustmentBaseSize</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> + <property name="adjustment">adjustmentBaseSize</property> <child internal-child="accessible"> <object class="AtkObject" id="spinB_baseSize-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_baseSize">All elements of a formula are proportionally scaled to the base size. To change the base size, select or type in the desired point (pt) size. You can also use other units of measure or other metrics, which are then automatically converted to points.</property> @@ -187,28 +187,28 @@ <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=2 n-rows=5 --> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="can-focus">False</property> <property name="margin-start">12</property> <property name="margin-top">6</property> + <property name="hexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkSpinButton" id="spinB_function"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> - <property name="adjustment">adjustmentRelativeSizes1</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> + <property name="adjustment">adjustmentRelativeSizes1</property> <child internal-child="accessible"> <object class="AtkObject" id="spinB_function-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_function">Select the relative size for names and other function elements in a formula in proportion to the base size.</property> @@ -216,46 +216,46 @@ </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="fontsizedialog|label2">_Operators:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">spinB_operator</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">spinB_operator</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="fontsizedialog|label3">_Limits:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">spinB_limit</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">spinB_limit</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">0</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkSpinButton" id="spinB_operator"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> - <property name="adjustment">adjustmentRelativeSizes2</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> + <property name="adjustment">adjustmentRelativeSizes2</property> <child internal-child="accessible"> <object class="AtkObject" id="spinB_operator-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_operator">Select the relative size of the mathematical operators in a formula in proportion to the base size.</property> @@ -263,18 +263,18 @@ </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="left-attach">1</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkSpinButton" id="spinB_limit"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> - <property name="adjustment">adjustmentRelativeSizes3</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> + <property name="adjustment">adjustmentRelativeSizes3</property> <child internal-child="accessible"> <object class="AtkObject" id="spinB_limit-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_limit">Select the relative size for the limits in a formula in proportion to the base size.</property> @@ -282,60 +282,60 @@ </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> + <property name="left-attach">1</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkLabel" id="label5"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="fontsizedialog|label5">_Text:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">spinB_text</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">spinB_text</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label7"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="fontsizedialog|label7">_Functions:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">spinB_function</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">spinB_function</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="label6"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="fontsizedialog|label6">_Indexes:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">spinB_index</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">spinB_index</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkSpinButton" id="spinB_text"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> - <property name="adjustment">adjustmentRelativeSizes4</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> + <property name="adjustment">adjustmentRelativeSizes4</property> <child internal-child="accessible"> <object class="AtkObject" id="spinB_text-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_text">Select the size for text in a formula relative to the base size.</property> @@ -343,18 +343,18 @@ </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkSpinButton" id="spinB_index"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> - <property name="adjustment">adjustmentRelativeSizes5</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> + <property name="adjustment">adjustmentRelativeSizes5</property> <child internal-child="accessible"> <object class="AtkObject" id="spinB_index-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|spinB_index">Select the relative size for the indexes in a formula in proportion to the base size.</property> @@ -362,8 +362,8 @@ </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> </object> @@ -371,7 +371,7 @@ <child type="label"> <object class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="fontsizedialog|label1">Relative Sizes</property> <attributes> <attribute name="weight" value="bold"/> @@ -399,9 +399,6 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> - <child type="titlebar"> - <placeholder/> - </child> <child internal-child="accessible"> <object class="AtkObject" id="FontSizeDialog-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="fontsizedialog|extended_tip|FontSizeDialog">Use this dialog to specify the font sizes for your formula. Select a base size and all elements of the formula will be scaled in relation to this base.</property> commit 5f89458043a828998e9ca13382a98f8f9aba0939 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 4 14:33:32 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 4 19:27:19 2025 +0200 tdf#130857 qt weld: Use QDoubleSpinBox logic when no parser set commit 210c69cf7aaa314f932a9debe0e64ba2789f2365 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Thu Feb 20 19:22:52 2025 +0100 tdf#130857 qt weld: Implement spin button input validation implemented input validation for QtInstanceSpinButton and QtInstanceFormattedSpinButton. If a function to parse the text is set, QtDoubleSpinBox::validate uses that to validate the input, as the commit message mentions: > If a handler for parsing the text is set and > it can successfully parse the text, return > QValidator::Acceptable, otherwise > QValidator::Intermediate (allowing to continue > editing/typing). This implementation however assumes that the parser function will return a std::optional containing a value when the input is valid. That assumption is correct for QtInstanceFormattedSpinButton. For QtInstanceSpinButton however, there's also the case where no formatter has been set, in which case weld::SpinButton::parse_text returns TRISTATE_INDET (s. its documentation). So far, this resulted in QtInstanceSpinButton::convertTextToDouble - which was set for QtDoubleSpinBox::m_aParseTextFunction, i.e. as the function to parse the text - to always return an empty std::optional. As a consequence, the value wouldn't be accepted by QtDoubleSpinBox, e.g. for the following scenario since the above-mentioned commit when using the qt5 or qt6 VCL plugin with SAL_VCL_QT_USE_WELDED_WIDGETS=1: 1) "Tools" -> "Options" -> "Advanced" -> "Open Expert Configuration" 2) search for "LibreOfficeTheme" 3) double-click on the config entry (of type short) 4) in the spinbox, manually type a value of 2 5) press Tab to move focus out of the spinbox Result: The manually typed value of 2 gets reset to the previous value (currently 0 by default) instead of taking over the new value. Fix this by extending QtDoubleSpinBox::m_aParseTextFunction to use the same semantics as weld::SpinButton::parse_text, i.e. return a Tristate value which allows to distinguish between the 3 different outcomes (parser set and value could be parsed, parser set and value could not be parsed, no parser set) and in case it returns TRISTATE_INDET (indicating that no parser is set), fall back to the logic in the QDoubleSpinBox base class to try to parse/validate the current text. Change-Id: Ic811dae10ecfd624e8f2e26022a61a95365152c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183713 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/inc/qt5/QtDoubleSpinBox.hxx b/vcl/inc/qt5/QtDoubleSpinBox.hxx index 190587446b92..c927ef779470 100644 --- a/vcl/inc/qt5/QtDoubleSpinBox.hxx +++ b/vcl/inc/qt5/QtDoubleSpinBox.hxx @@ -9,6 +9,8 @@ #pragma once +#include <tools/gen.hxx> + #include <QtWidgets/QDoubleSpinBox> #include <QtWidgets/QLineEdit> #include <QtWidgets/QWidget> @@ -20,7 +22,8 @@ class QtDoubleSpinBox : public QDoubleSpinBox Q_OBJECT std::function<std::optional<QString>(double)> m_aFormatValueFunction; - std::function<std::optional<double>(const QString&)> m_aParseTextFunction; + // see weld::SpinButton::parse_text for semantics + std::function<TriState(const QString&, double*)> m_aParseTextFunction; public: QtDoubleSpinBox(QWidget* pParent); @@ -37,7 +40,7 @@ public: m_aFormatValueFunction = aFunction; } - void setParseTextFunction(std::function<std::optional<double>(const QString&)> aFunction) + void setParseTextFunction(std::function<TriState(const QString&, double*)> aFunction) { m_aParseTextFunction = aFunction; } diff --git a/vcl/inc/qt5/QtInstanceSpinButton.hxx b/vcl/inc/qt5/QtInstanceSpinButton.hxx index d1f6c76751df..0fc5c8b8beda 100644 --- a/vcl/inc/qt5/QtInstanceSpinButton.hxx +++ b/vcl/inc/qt5/QtInstanceSpinButton.hxx @@ -38,7 +38,6 @@ public: virtual unsigned int get_digits() const override; private: - std::optional<double> convertTextToDouble(const QString& rText); std::optional<QString> formatValue(double fValue); private Q_SLOTS: diff --git a/vcl/qt5/QtDoubleSpinBox.cxx b/vcl/qt5/QtDoubleSpinBox.cxx index 88dc97319653..e57445ae77b6 100644 --- a/vcl/qt5/QtDoubleSpinBox.cxx +++ b/vcl/qt5/QtDoubleSpinBox.cxx @@ -35,9 +35,10 @@ double QtDoubleSpinBox::valueFromText(const QString& rText) const { if (m_aParseTextFunction) { - std::optional<double> aValue = m_aParseTextFunction(rText); - if (aValue.has_value()) - return aValue.value(); + double fValue = 0; + const TriState eState = m_aParseTextFunction(rText, &fValue); + if (eState == TRISTATE_TRUE) + return fValue; } return QDoubleSpinBox::valueFromText(rText); @@ -47,9 +48,18 @@ QValidator::State QtDoubleSpinBox::validate(QString& rInput, int& rPos) const { if (m_aParseTextFunction) { - if (m_aParseTextFunction(rInput).has_value()) - return QValidator::Acceptable; - return QValidator::Intermediate; + double fValue = 0; + const TriState eState = m_aParseTextFunction(rInput, &fValue); + switch (eState) + { + case TRISTATE_TRUE: + return QValidator::Acceptable; + case TRISTATE_FALSE: + return QValidator::Intermediate; + case TRISTATE_INDET: + // no parser function set, use default QDoubleSpinBox logic + break; + } } return QDoubleSpinBox::validate(rInput, rPos); diff --git a/vcl/qt5/QtInstanceFormattedSpinButton.cxx b/vcl/qt5/QtInstanceFormattedSpinButton.cxx index c1132ccc1ea2..02db87192b72 100644 --- a/vcl/qt5/QtInstanceFormattedSpinButton.cxx +++ b/vcl/qt5/QtInstanceFormattedSpinButton.cxx @@ -37,8 +37,16 @@ QtInstanceFormattedSpinButton::QtInstanceFormattedSpinButton(QtDoubleSpinBox* pS // set functions to convert between value and formatted text m_pSpinBox->setFormatValueFunction([this](double fValue) { return formatValue(fValue); }); - m_pSpinBox->setParseTextFunction( - [this](const QString& rText) { return GetFormatter().ParseText(toOUString(rText)); }); + m_pSpinBox->setParseTextFunction([this](const QString& rText, double* pResult) { + std::optional<double> aRet = GetFormatter().ParseText(toOUString(rText)); + if (aRet.has_value()) + { + *pResult = aRet.value(); + return TRISTATE_TRUE; + } + + return TRISTATE_FALSE; + }); } QWidget* QtInstanceFormattedSpinButton::getQWidget() const { return m_pSpinBox; } diff --git a/vcl/qt5/QtInstanceSpinButton.cxx b/vcl/qt5/QtInstanceSpinButton.cxx index 3305c5f5e5de..636c82212db6 100644 --- a/vcl/qt5/QtInstanceSpinButton.cxx +++ b/vcl/qt5/QtInstanceSpinButton.cxx @@ -36,8 +36,9 @@ QtInstanceSpinButton::QtInstanceSpinButton(QtDoubleSpinBox* pSpinBox) // set functions to convert between value and formatted text m_pSpinBox->setFormatValueFunction([this](double fValue) { return formatValue(fValue); }); - m_pSpinBox->setParseTextFunction( - [this](const QString& rText) { return convertTextToDouble(rText); }); + m_pSpinBox->setParseTextFunction([this](const QString& rText, double* pResult) { + return parse_text(toOUString(rText), pResult); + }); } QWidget* QtInstanceSpinButton::getQWidget() const { return m_pSpinBox; } @@ -106,16 +107,6 @@ unsigned int QtInstanceSpinButton::get_digits() const return nDigits; } -std::optional<double> QtInstanceSpinButton::convertTextToDouble(const QString& rText) -{ - double fValue = 0; - TriState eState = parse_text(toOUString(rText), &fValue); - if (eState == TRISTATE_TRUE) - return std::optional<double>(fValue); - - return {}; -} - std::optional<QString> QtInstanceSpinButton::formatValue(double fValue) { std::optional<OUString> aText = format_floating_point_value(fValue);