tdf#130857 printersetupdialog.ui: Define focusable widgets in order

Align the order in which the focusable widgets (combobox, "Properties"
button) are defined in the .ui (XML) file with the order in which they
should receive focus. While the position in the GtkGrid is defined
by the "left-attach" and "top-attach" packing properties and
QtBuilder evaluates those, the tab order in Qt by default matches
the order in which widgets are created (s. e.g. [1]).

Without this commit in place the "properties" button was constructed
before the "name" combobox (because it was further up in
the .ui file, i.e. the XML parser processed it earlier), resulting
in an unexpected order when using the Tab key to navigate through
the "Tools" -> "Printer Settings" dialog:

From the "Options" button in the button box, focus would jump
to the "Properties" button, and only then to the combobox, and
from there, it would jump to the "Help" button in the button box.

Now, it jumps from the "Options" button to the combobox,
and after selecting the printer there, pressing Tab another
time moves focus to the "Properties" button as expected, which
can be used to open another dialog that allows to change properties
of the previously selected printer.

A potential alternative to adjusting the .ui file could be to
explicitly set the tab order using QWidget::setTabOrder [2]
in QtBuilder.

[1] https://doc.qt.io/qt-6/designer-tab-order.html
[2] https://doc.qt.io/qt-6/qwidget.html#setTabOrder

Change-Id: If3aa014e20b97fe8bb772ef212741af1433b0244
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175523
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn 2024-10-23 22:43:10 +02:00
parent f1247eba64
commit 0fe7b3cebc

View file

@ -116,6 +116,39 @@
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="name">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="name-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="printersetupdialog|extended_tip|name">Lists the installed printers on your operating system. To change the default printer, select a printer name from the list.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="properties">
<property name="label" translatable="yes" context="printersetupdialog|properties">Properties...</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="properties-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="printersetupdialog|extended_tip|properties">Changes the printer settings of your operating system for the current document.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
@ -212,39 +245,6 @@
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="properties">
<property name="label" translatable="yes" context="printersetupdialog|properties">Properties...</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="properties-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="printersetupdialog|extended_tip|properties">Changes the printer settings of your operating system for the current document.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="name">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="name-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="printersetupdialog|extended_tip|name">Lists the installed printers on your operating system. To change the default printer, select a printer name from the list.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
</child>
<child type="label">